Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lyse/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ def __init__(self, qapplication):
# Forth: start remote communication server
self.port = int(self.exp_config.get('ports', 'lyse'))
self.server = lyse.communication.WebServer(self, self.port)
self.logger.info(f'Started lyse server on port {self.port}')

# Last: UI setup
self.qapplication = qapplication
loader = UiLoader()
self.ui = loader.load(os.path.join(lyse.utils.LYSE_DIR, 'user_interface/main.ui'), LyseMainWindow(self))
self.logger.info('UI loaded')

self.connect_signals()

Expand All @@ -138,6 +140,7 @@ def __init__(self, qapplication):
self, to_multishot, from_multishot, self.output_box.port, multishot=True)
self.filebox = lyse.filebox.FileBox(self, self.ui.verticalLayout_filebox, self.exp_config,
to_singleshot, from_singleshot, to_multishot, from_multishot)
self.logger.info('Boxes loaded')

self.last_save_config_file = None
self.last_save_data = None
Expand Down Expand Up @@ -188,6 +191,7 @@ def load_the_config_file():
# Success - skip loading window geometry in load_configuration:
restore_window_geometry = False
self.ui.firstPaint.connect(lambda: QtCore.QTimer.singleShot(50, load_the_config_file))
self.logger.info('lyse configuration loaded')

self.ui.show()

Expand Down Expand Up @@ -522,7 +526,7 @@ def delete_items(self, confirm):
signal.signal(signal.SIGINT, lambda *args: qapplication.exit())

splash.hide()
qapplication.exec_()
qapplication.exec()

# Shutdown the webserver.
app.server.shutdown()
2 changes: 1 addition & 1 deletion lyse/analysis_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,5 +475,5 @@ def reset_figs(self):
if qapplication is None:
qapplication = QtWidgets.QApplication(sys.argv)
worker = AnalysisWorker(filepath, to_parent, from_parent)
qapplication.exec_()
qapplication.exec()

4 changes: 2 additions & 2 deletions lyse/filebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def on_treeView_context_menu_requested(self, point):
menu = QtWidgets.QMenu(self.ui)
menu.addAction(self.action_set_selected_visible)
menu.addAction(self.action_set_selected_hidden)
menu.exec_(QtGui.QCursor.pos())
menu.exec(QtGui.QCursor.pos())

def on_set_selected_triggered(self, visible):
selected_indexes = self.ui.treeView.selectedIndexes()
Expand Down Expand Up @@ -373,7 +373,7 @@ def mark_selection_not_done(self):
def on_view_context_menu_requested(self, point):
menu = QtWidgets.QMenu(self._view)
menu.addAction(self.action_remove_selected)
menu.exec_(QtGui.QCursor.pos())
menu.exec(QtGui.QCursor.pos())

def on_double_click(self, index):
filepath_item = self._model.item(index.row(), self.COL_FILEPATH)
Expand Down
18 changes: 14 additions & 4 deletions lyse/routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ def __init__(self, app, container, exp_config, filebox, from_filebox, to_filebox
self.to_filebox = to_filebox
self.output_box_port = output_box_port

self.logger = logging.getLogger('lyse.RoutineBox.%s'%('multishot' if multishot else 'singleshot'))
self.logger = logging.getLogger('lyse.RoutineBox.%s'%('multishot' if multishot else 'singleshot'))
self.logger.info('starting')

loader = UiLoader()
loader.registerCustomWidget(lyse.widgets.TreeView)
self.ui = loader.load(os.path.join(lyse.utils.LYSE_DIR, 'user_interface/routinebox.ui'))
container.addWidget(self.ui)
self.logger.info('UI loaded')

if multishot:
self.ui.groupBox.setTitle('Multishot routines')
Expand Down Expand Up @@ -110,6 +112,7 @@ def __init__(self, app, container, exp_config, filebox, from_filebox, to_filebox

self.connect_signals()

self.logger.info('starting analysis loop')
self.analysis = threading.Thread(target = self.analysis_loop)
self.analysis.daemon = True
self.analysis.start()
Expand Down Expand Up @@ -170,7 +173,9 @@ def add_routines(self, routine_files, clear_existing=False):
if filepath in [routine.filepath for routine in self.routines]:
self.app.output_box.output('Warning: Ignoring duplicate analysis routine %s\n'%filepath, red=True)
continue
routine = AnalysisRoutine(self.app, filepath, self.model, self.output_box_port, checked)
self.logger.info(f'adding routine for {filepath}')
routine = AnalysisRoutine(self.app, filepath, self.model, self.output_box_port,
QtCore.Qt.CheckState(checked))
self.routines.append(routine)
self.update_select_all_checkstate()

Expand Down Expand Up @@ -215,6 +220,7 @@ def remove_selection(self, confirm=True):
if routine.filepath in filepaths:
routine.remove()
self.routines.remove(routine)
self.logger.info(f'removing routine for {routine.filepath}')
self.update_select_all_checkstate()

def on_model_item_changed(self, item):
Expand All @@ -237,7 +243,7 @@ def on_treeView_context_menu_requested(self, point):
menu.addAction(self.action_set_selected_inactive)
menu.addAction(self.action_restart_selected)
menu.addAction(self.action_remove_selected)
menu.exec_(QtGui.QCursor.pos())
menu.exec(QtGui.QCursor.pos())

def on_set_selected_triggered(self, active):
selected_indexes = self.ui.treeView.selectedIndexes()
Expand Down Expand Up @@ -423,8 +429,12 @@ def __init__(self, app, filepath, model, output_box_port, checked=QtCore.Qt.Chec

self.error = False
self.done = False


self.logger = logging.getLogger(f'lyse.AnalysisRoutine.{self.shortname}')

self.logger.info('starting worker')
self.to_worker, self.from_worker, self.worker = self.start_worker()
self.logger.info('analysis_subprocess started')

# Make a row to put into the model:
active_item = QtGui.QStandardItem()
Expand Down
8 changes: 4 additions & 4 deletions lyse/utils/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def get_screen_geometry(qapplication):
"""Return the a list of the geometries of each screen: each a tuple of
left, top, width and height"""
geoms = []
desktop = qapplication.desktop()
for i in range(desktop.screenCount()):
sg = desktop.screenGeometry(i)
geoms.append((sg.left(), sg.top(), sg.width(), sg.height()))
screens = qapplication.screens()
for screen in screens:
sg = screen.geometry()
geoms.append((sg.x(), sg.y(), sg.width(), sg.height()))
return geoms
2 changes: 1 addition & 1 deletion lyse/utils/tempfile2clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main():

# Keep running until the clipboard contents change to something else:
app.clipboard().dataChanged.connect(app.quit)
app.exec_()
app.exec()


if __name__ == '__main__':
Expand Down