本文整理汇总了Python中cecog.gui.progressdialog.ProgressDialog.exec_方法的典型用法代码示例。如果您正苦于以下问题:Python ProgressDialog.exec_方法的具体用法?Python ProgressDialog.exec_怎么用?Python ProgressDialog.exec_使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cecog.gui.progressdialog.ProgressDialog
的用法示例。
在下文中一共展示了ProgressDialog.exec_方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NavigationModule
# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import exec_ [as 别名]
#.........这里部分代码省略.........
coordinate = self.browser.get_coordinate()
plates = self._imagecontainer.plates
idx = plates.index(coordinate.plate)
if idx < len(plates)-1:
coordinate.plate = plates[idx+1]
self._set_plate(coordinate, True)
def _get_closeby_position(self, coordinate_old, coordinate_new):
md_new = self._imagecontainer.get_meta_data()
if coordinate_old.position in md_new.positions:
coordinate_new.position = coordinate_old.position
else:
coordinate_new.position = md_new.positions[0]
def _get_closeby_time(self, coordinate_old, coordinate_new):
md_new = self._imagecontainer.get_meta_data()
if coordinate_old.time in md_new.times:
coordinate_new.time = coordinate_old.time
else:
coordinate_new.time = md_new.times[0]
def _on_plate_changed(self, current, previous):
coordinate_new = self.browser.get_coordinate()
item = self._table_plate.item(current.row(), 0)
plate = item.data(0)
coordinate_new.plate = plate
self._set_plate(coordinate_new)
def _set_plate(self, coordinate_new, set_current=False):
coordinate_old = self.browser.get_coordinate()
plate = coordinate_new.plate
func = lambda: self._imagecontainer.set_plate(plate)
self.dlg = ProgressDialog("Loading plate...", None, 0, 0, self)
self.dlg.exec_(func)
meta_data = self._imagecontainer.get_meta_data()
if set_current:
self._set_current_plate(plate)
self._update_position_table(meta_data)
self._get_closeby_position(coordinate_old, coordinate_new)
self._set_current_position(coordinate_new.position)
if self._imagecontainer.has_timelapse:
self._update_time_table(meta_data, coordinate_new)
self._get_closeby_time(coordinate_old, coordinate_new)
self._set_current_time(coordinate_new.time)
self._update_info_frame(meta_data)
self.coordinate_changed.emit(coordinate_new)
def _on_position_changed(self, current, previous):
coordinate = self.browser.get_coordinate()
item = self._table_position.item(current.row(), 0)
position = item.data(0)
coordinate.position = position
self._set_position(coordinate)
def _set_position(self, coordinate, set_current=False):
if set_current:
self._set_current_position(coordinate.position)
if self._imagecontainer.has_timelapse:
meta_data = self._imagecontainer.get_meta_data()
self._update_time_table(meta_data, coordinate)
self._set_current_time(coordinate.time)
self.coordinate_changed.emit(coordinate)
def _on_time_changed(self, current, previous):
coordinate = self.browser.get_coordinate()
示例2: ClusterDisplay
# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import exec_ [as 别名]
#.........这里部分代码省略.........
self._imagecontainer = imagecontainer
def _on_jobid_entered(self, txt):
self._jobid = str(txt)
@pyqtSlot()
def _on_submit_job(self):
self._submit_settings.set_section(SECTION_NAME_GENERAL)
if not self._submit_settings.get2('constrain_positions'):
positions = []
for plate_id in self.imagecontainer.plates:
self.imagecontainer.set_plate(plate_id)
meta_data = self.imagecontainer.get_meta_data()
positions += ['%s___%s' % (plate_id, p) for p in meta_data.positions]
self._submit_settings.set2('positions', ','.join(positions))
nr_items = len(positions)
else:
positions = self._submit_settings.get2('positions')
nr_items = len(positions.split(','))
# FIXME: we need to get the current value for 'position_granularity'
settings_dummy = self._clusterframe.get_special_settings(self._settings)
position_granularity = settings_dummy.get('Cluster', 'position_granularity')
path_out = self._submit_settings.get2('pathout')
emails = str(self._txt_mail.text()).split(',')
try:
self.dlg = ProgressDialog("submitting jobs...", None, 0, 0, self)
settings_str = self._submit_settings.to_string()
func = lambda: self._service.submit_job('cecog_batch', settings_str,
path_out, emails, nr_items,
position_granularity, VERSION)
self.dlg.exec_(func)
jobid = self.dlg.getTargetResult()
except Exception as e:
exception(self, 'Error on job submission (%s)' %str(e))
else:
# FIXME: no idea how DRMAA 1.0 compatible this is
if type(jobid) == types.ListType:
self._jobid = ','.join(jobid)
main_jobid = jobid[0].split('.')[0]
else:
self._jobid = str(jobid)
main_jobid = jobid
self._txt_jobid.setText(self._jobid)
self._update_job_status()
information(self, 'Job submitted successfully',
"Job successfully submitted to the cluster.\nJob ID: %s, items: %d" % (main_jobid, nr_items))
@pyqtSlot()
def _on_terminate_job(self):
try:
self.dlg = ProgressDialog("terminating jobs...", None, 0, 0, self)
func = lambda: self._service.control_job(self._jobid, JOB_CONTROL_TERMINATE)
self.dlg.exec_(func)
except Exception as e:
exception(self, 'Error on job termination (%s)' %str(e))
else:
self._btn_toogle.setChecked(False)
self._toggle_state = JOB_CONTROL_SUSPEND
self._btn_toogle.setText(self._toggle_state)
self._update_job_status()
@pyqtSlot()
def _on_toggle_job(self):
示例3: BaseProcessorFrame
# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import exec_ [as 别名]
#.........这里部分代码省略.........
Qt.QueuedConnection)
result_frame.reset()
elif cls is MultiAnalyzerThread:
self._current_settings = self._get_modified_settings(name, imagecontainer.has_timelapse)
self._analyzer = cls(self, self._current_settings, imagecontainer, ncpu)
elif cls is ErrorCorrectionThread:
self._current_settings = self._get_modified_settings(name, imagecontainer.has_timelapse)
self._analyzer = cls(self, self._current_settings,
self.parent().main_window._imagecontainer)
self._analyzer.finished.connect(self._on_process_finished)
self._analyzer.stage_info.connect(self._on_update_stage_info, Qt.QueuedConnection)
self._analyzer.analyzer_error.connect(self._on_error, Qt.QueuedConnection)
self._analyzer.image_ready.connect(self._on_update_image)
self._analyzer.start(QThread.LowestPriority)
if self._current_process_item == 0:
self.status_message.emit('Process started...')
else:
self._abort_processing()
def _toggle_tabs(self, state):
if not self.TABS is None:
self._tab.enable_non_active(state)
def _abort_processing(self):
self.setCursor(Qt.BusyCursor)
self._is_abort = True
self.dlg = ProgressDialog('terminating...', None, 0, 0, self)
self.dlg.exec_(lambda: self._analyzer.abort(wait=True))
self.setCursor(Qt.ArrowCursor)
def _on_error(self, msg, short='An error occurred during processing!'):
self._has_error = True
critical(self, short, detail=msg)
def _on_process_finished(self):
self._analyzer.image_ready.disconnect(self._on_update_image)
if (not self._process_items is None and
self._current_process_item+1 < len(self._process_items) and
not self._is_abort and
not self._has_error):
self._current_process_item += 1
self._on_process_start(self._current_process, start_again=True)
else:
self._is_running = False
self._set_control_button_text(idx=0)
self.process_control.toggleButtons(self._current_process)
self._toggle_tabs(True)
# enable all section button of the main widget
self.toggle_tabs.emit(self.get_name())
if not self._is_abort and not self._has_error:
if self.name == SECTION_NAME_OBJECTDETECTION:
msg = 'Object detection successfully finished.'
elif self.name == SECTION_NAME_CLASSIFICATION:
if self._current_process == self.PICKING:
msg = 'Samples successfully picked.\n\n'\
'Please train the classifier now based on the '\
'newly picked samples.'
result_frame = self._get_result_frame(self._tab_name)
result_frame.load_classifier(check=False)
示例4: ClusterDisplay
# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import exec_ [as 别名]
#.........这里部分代码省略.........
@pyqtSlot()
def _on_submit_job(self):
self._submit_settings.set_section(SECTION_NAME_GENERAL)
if not self._submit_settings.get2('constrain_positions'):
positions = []
for plate_id in self.imagecontainer.plates:
self.imagecontainer.set_plate(plate_id)
meta_data = self.imagecontainer.get_meta_data()
positions += ['%s___%s' % (plate_id, p) for p in meta_data.positions]
self._submit_settings.set2('positions', ','.join(positions))
nr_items = len(positions)
else:
positions = self._submit_settings.get2('positions')
nr_items = len(positions.split(','))
settings_dummy = self._clusterframe.get_special_settings(self._settings)
apc = AppPreferences()
batch_size = apc.batch_size
pathout = self._submit_settings.get2('pathout')
if not self._submit_settings('General', 'skip_finished'):
self.clear_output_directory(self._settings("General", "pathout"))
try:
self.dlg = ProgressDialog("Submitting Jobs...", None, 0, 0, self)
settings_str = self._submit_settings.to_string()
func = lambda: self._service.submit_job('cecog_batch', settings_str,
pathout, nr_items,
batch_size, version)
self.dlg.exec_(func)
jobid = self.dlg.getTargetResult()
except Exception as e:
QMessageBox.critical(
self, "Error", 'Job submission failed (%s)' %str(e))
else:
# FIXME: no idea how DRMAA 1.0 compatible this is
if type(jobid) == types.ListType:
self._jobid = ','.join(jobid)
main_jobid = jobid[0].split('.')[0]
else:
self._jobid = str(jobid)
main_jobid = jobid
self._txt_jobid.setText(self._jobid)
self._update_job_status()
QMessageBox.information(
self, "Information", ("Job(s) successfully submitted\n"
"Job ID: %s, #jobs: %d" % (main_jobid, nr_items)))
@pyqtSlot()
def _on_terminate_job(self):
if self.jobIds is None:
return
try:
self.dlg = ProgressDialog("Terminating Jobs...", None, 0, 0, self)
func = lambda: self._service.control_job(self._jobid, JOB_CONTROL_TERMINATE)
self.dlg.exec_(func)
except Exception as e:
QMessageBox.critical(
self, "Error", "Job termination failed (%s)" %str(e))
else:
self._btn_toogle.setChecked(False)
示例5: CecogAnalyzer
# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import exec_ [as 别名]
#.........这里部分代码省略.........
# notify tabs about new settings loaded
for tab in self._tabs:
tab.settings_loaded()
self.statusBar().showMessage('Settings successfully loaded.')
def _write_settings(self, filename):
try:
f = file(filename, 'w')
# create a new version (copy) of the current
# settings which add the needed rendering information
pframe = self._tab_lookup[SECTION_NAME_PROCESSING][1]
settings_dummy = pframe.get_export_settings(self._settings)
settings_dummy.write(f)
f.close()
except Exception as e:
msg = "Could not save settings\n%s" %str(e)
QMessageBox.critical(self, "Error", msg)
self.statusBar().showMessage('Settings not successfully saved.')
else:
self._settings_filename = filename
self.setWindowTitle('%s - %s[*]' % (self.appname, filename))
self.settings_changed(False)
self.statusBar().showMessage('Settings successfully saved.')
def on_about(self):
dialog = CecogAboutDialog(self)
dialog.show()
def about_qt(self):
QMessageBox.aboutQt(self, "about Qt")
def open_preferences(self):
pref = PreferencesDialog(self)
pref.exec_()
def updateStyleSheet(self, stylesheet):
self.setStyleSheet("")
self.setStyleSheet(stylesheet)
self._pages.assistant.setStyleSheet("")
self._pages.assistant.setStyleSheet(stylesheet)
if self._browser is not None:
self._browser.setStyleSheet("")
self._browser.setStyleSheet(stylesheet)
def _on_browser_open(self):
if self._imagecontainer is None:
QMessageBox.warning(self, 'Data structure not loaded',
'The input directory structure file was not loaded.\n'
'Click "Scan input directory" in section "General" to proceed.')
elif self._browser is None:
try:
browser = Browser(self._settings, self._imagecontainer, None)
browser.show()
browser.raise_()
browser.setFocus()
app = AppPreferences()
browser.setStyleSheet(loadStyle(app.stylesheet))
self._browser = browser
except Exception as e:
traceback.print_exc()
QMessageBox.critical(self, "Error", str(e))
else:
self._browser.show()
self._browser.raise_()
示例6: BaseProcessorFrame
# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import exec_ [as 别名]
#.........这里部分代码省略.........
self._analyzer = cls(
self, self._current_settings, imagecontainer)
elif cls is ErrorCorrectionThread:
self._current_settings = self._get_modified_settings(
name, imagecontainer.has_timelapse)
self._analyzer = cls(
self, self._current_settings,
self.parent().main_window._imagecontainer)
self._analyzer.finished.connect(self._on_process_finished)
self._analyzer.status.connect(
self._on_update_stage_info, Qt.QueuedConnection)
self._analyzer.error.connect(self._on_error, Qt.QueuedConnection)
self._analyzer.increment.connect(self.process_control.increment)
self._analyzer.image_ready.connect(self._on_update_image)
self._analyzer.start(QThread.LowestPriority)
if self._current_process_item == 0:
self.status_message.emit('Process started...')
else:
self._abort_processing()
def _toggle_tabs(self, state):
if not self.TABS is None:
self._tab.enable_non_active(state)
def _abort_processing(self):
self.setCursor(Qt.BusyCursor)
self._is_abort = True
self.dlg = ProgressDialog('terminating...', None, 0, 0, self)
self.dlg.exec_(lambda: self._analyzer.abort(wait=True))
self.setCursor(Qt.ArrowCursor)
def _on_error(self, msg, short='Error'):
self._has_error = True
QMessageBox.critical(self, short, msg)
def _on_process_finished(self):
self._analyzer.image_ready.disconnect(self._on_update_image)
self.process_control.reset()
if (not self._process_items is None and
self._current_process_item+1 < len(self._process_items) and
not self._is_abort and
not self._has_error):
self._current_process_item += 1
self._on_process_start(self._current_process, start_again=True)
else:
self._is_running = False
self._set_control_button_text(idx=0)
self.process_control.toggleButtons(self._current_process)
self._toggle_tabs(True)
# enable all section button of the main widget
self.toggle_tabs.emit(self.get_name())
msg = 'Processing successfully finished'
if not self._is_abort and not self._has_error:
if self.name == SECTION_NAME_OBJECTDETECTION:
msg = 'Object detection successfully finished.'
elif self.name == SECTION_NAME_TRACKING:
msg = 'Tracking successfully finished.'
elif self.name == SECTION_NAME_EVENT_SELECTION:
msg = 'Event selection successfully finished.'