当前位置: 首页>>代码示例>>Python>>正文


Python progressdialog.ProgressDialog类代码示例

本文整理汇总了Python中cecog.gui.progressdialog.ProgressDialog的典型用法代码示例。如果您正苦于以下问题:Python ProgressDialog类的具体用法?Python ProgressDialog怎么用?Python ProgressDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ProgressDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _connect

    def _connect(self):

        success = False
        try:
            self._check_host_url()
            client = RemotingService(self._host_url)
            self.dlg = ProgressDialog("Connecting to Cluster...", None, 0, 0, self)
            func = lambda: client.getService('clustercontrol')
            self.dlg.exec_(func)
            self._service = self.dlg.getTargetResult()
            self._check_api_version()
        except ConnectionError as e:
            msg = ("%s\nDo you want to turn off the cluster support?") %str(e)
            ret = QMessageBox.question(
                self, "Error", msg)
            if ret == QMessageBox.Yes:
                self._turn_off_cluster_support()
        except Exception as e:
            QMessageBox.critical(self, "Error", str(e))
        else:
            try:
                self.dlg.exec_(self._service.get_cecog_versions)
                cluster_versions = self.dlg.getTargetResult()
            except Exception as e:
                QMessageBox.critical(self, "Error", str(e))
            else:
                if not version in set(cluster_versions):
                    QMessageBox.warning(
                        self, "Warning",
                        ("Cluster does not support %s %s"
                         "Available versions: %s"
                         %(appname, version, ', '.join(cluster_versions))))
                else:
                    success = True
        return success
开发者ID:CellCognition,项目名称:cecog,代码行数:35,代码来源:cluster.py

示例2: _connect

    def _connect(self):
        self._check_host_url()

        success = False
        msg = 'Error on connecting to cluster control service on %s' % self._host_url
        try:
            client = RemotingService(self._host_url)
            self.dlg = ProgressDialog("connecting to cluster...", None, 0, 0, self)
            func = lambda: client.getService('clustercontrol')
            self.dlg.exec_(func)
            self._service = self.dlg.getTargetResult()
        except:
            exception(self, msg)
        else:
            try:
                self.dlg.exec_(self._service.get_cecog_versions)
                cluster_versions = self.dlg.getTargetResult()
            except Exception as e:
                exception(self, msg + '(%s)' %str(e))
            else:
                if not VERSION in set(cluster_versions):
                    warning(self, 'Cecog version %s not supported by the cluster' %
                            VERSION, 'Valid versions are: %s' \
                                % ', '.join(cluster_versions))
                else:
                    success = True
        return success
开发者ID:manerotoni,项目名称:cecog,代码行数:27,代码来源:cluster.py

示例3: _update_job_status

 def _update_job_status(self):
     try:
         self.dlg = ProgressDialog("updating job status...", None, 0, 0, self)
         func = lambda: self._service.get_job_status(self._jobid)
         self.dlg.exec_(func)
         txt = self.dlg.getTargetResult()
     except Exception as e:
         exception(self, 'Error on retrieve job status (%s)' %str(e))
     else:
         self._label_jobstatus.setText(txt)
     return txt
开发者ID:manerotoni,项目名称:cecog,代码行数:11,代码来源:cluster.py

示例4: _on_terminate_job

 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()
开发者ID:manerotoni,项目名称:cecog,代码行数:12,代码来源:cluster.py

示例5: _on_submit_job

    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)))
开发者ID:CellCognition,项目名称:cecog,代码行数:50,代码来源:cluster.py

示例6: _on_toggle_job

 def _on_toggle_job(self):
     try:
         self.dlg = ProgressDialog("suspending jobs...", None, 0, 0, self)
         func = lambda: self._service.control_job(self._jobid, self._toggle_state)
         self.dlg.exec_(func)
     except Exception as e:
         self._toggle_state = JOB_CONTROL_SUSPEND
         self._btn_toogle.setChecked(False)
         exception(self, 'Error on toggle job status (%s)' %str(e))
     else:
         if self._toggle_state == JOB_CONTROL_SUSPEND:
             self._toggle_state = JOB_CONTROL_RESUME
         else:
             self._toggle_state = JOB_CONTROL_SUSPEND
         self._update_job_status()
     self._btn_toogle.setText(self._toggle_state)
开发者ID:manerotoni,项目名称:cecog,代码行数:16,代码来源:cluster.py

示例7: _update_job_status

    def _update_job_status(self):
        if self.jobIds is None:
            return

        try:
            self.dlg = ProgressDialog("Updating Job Status...", None, 0, 0, self)

            func = lambda: self._service.get_job_status(self._jobid)
            self.dlg.exec_(func)
            txt = self.dlg.getTargetResult()
        except Exception as e:
            QMessageBox.critical(
                self, "Error", 'Could not retrieve job status (%s)' %str(e))
        else:
            self._label_jobstatus.setText(txt)
            return txt
开发者ID:CellCognition,项目名称:cecog,代码行数:16,代码来源:cluster.py

示例8: _on_terminate_job

    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)
            self._toggle_state = JOB_CONTROL_SUSPEND
            self._btn_toogle.setText(self._toggle_state)
            self._update_job_status()
开发者ID:CellCognition,项目名称:cecog,代码行数:16,代码来源:cluster.py

示例9: _on_submit_job

    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))
开发者ID:manerotoni,项目名称:cecog,代码行数:43,代码来源:cluster.py

示例10: _set_plate

    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)
开发者ID:CellCognition,项目名称:cecog,代码行数:19,代码来源:navigation.py

示例11: _on_toggle_job

 def _on_toggle_job(self):
     if self.jobIds is None:
         return
     try:
         self.dlg = ProgressDialog("Suspending Jobs...", None, 0, 0, self)
         func = lambda: self._service.control_job(self._jobid, self._toggle_state)
         self.dlg.exec_(func)
     except Exception as e:
         self._toggle_state = JOB_CONTROL_SUSPEND
         self._btn_toogle.setChecked(False)
         QMessageBox.critical(
             self, "Error", "Could not toggle job status (%s)" %str(e))
     else:
         if self._toggle_state == JOB_CONTROL_SUSPEND:
             self._toggle_state = JOB_CONTROL_RESUME
         else:
             self._toggle_state = JOB_CONTROL_SUSPEND
         self._update_job_status()
     self._btn_toogle.setText(self._toggle_state)
开发者ID:CellCognition,项目名称:cecog,代码行数:19,代码来源:cluster.py

示例12: _abort_processing

 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)
开发者ID:jni,项目名称:cecog,代码行数:6,代码来源:__init__.py

示例13: CecogAnalyzer


#.........这里部分代码省略.........

                if not cancel:
                    self._load_image_container(infos, scan_plates)

    def _load_image_container(self, plate_infos=None, scan_plates=None,
                              show_dialog=True):
        self._clear_browser()

        if plate_infos is None:
            plate_infos = list(ImageContainer.iter_check_plates(self._settings))

        imagecontainer = ImageContainer()
        self._imagecontainer = imagecontainer

        if scan_plates is None:
            scan_plates = dict((info[0], False) for info in plate_infos)

        def load(emitter, icontainer, settings, splates):
            iter_ = icontainer.iter_import_from_settings(settings, scan_plates=splates)
            for idx, info in enumerate(iter_):
                emitter.setValue.emit(idx)

            emitter.setLabelText.emit("checking dimensions...")
            emitter.setRange.emit(0, 0)
            QtCore.QCoreApplication.processEvents()

            if len(icontainer.plates) > 0:
                icontainer.set_plate(icontainer.plates[0])
                icontainer.check_dimensions()


        label = ('Please wait until the input structure is scanned\n'
                 'or the structure data loaded...')
        self._dlg = ProgressDialog(label, None, 0, len(scan_plates), self)
        emitter = ProgressObject()
        emitter.setRange.connect(self._dlg.setRange)
        emitter.setValue.connect(self._dlg.setValue)
        emitter.setLabelText.connect(self._dlg.setLabelText)

        try:
            func = lambda: load(emitter, imagecontainer,
                                self._settings, scan_plates)
            self._dlg.exec_(func, (emitter, ))
        except ImportError as e:
            # structure file from versions older than 1.3 contain pdk which is
            # removed
            if 'pdk' in str(e):
                QMessageBox.critical(self, "Error",
                                     ("Your structure file format is outdated.\n"
                                      "You have to rescan the plate(s)"))
            else:
                QMessageBox.critical(self, "Error", traceback.format_exc())
            return
        except Exception as e:
            QMessageBox.critical(self, "Error", str(e))


        try: # I hate lookup tables!
            self._tab_lookup['Cluster'][1].set_imagecontainer(imagecontainer)
        except KeyError:
            pass

        if len(imagecontainer.plates) > 0:
            channels = imagecontainer.channels

            # do not report value changes to the main window
开发者ID:xiwei-zhang,项目名称:cecog,代码行数:67,代码来源:main.py

示例14: _load_image_container

    def _load_image_container(self, plate_infos=None, scan_plates=None,
                              show_dialog=True):
        self._clear_browser()

        if plate_infos is None:
            plate_infos = list(ImageContainer.iter_check_plates(self._settings))

        imagecontainer = ImageContainer()
        self._imagecontainer = imagecontainer

        if scan_plates is None:
            scan_plates = dict((info[0], False) for info in plate_infos)

        def load(emitter, icontainer, settings, splates):
            iter_ = icontainer.iter_import_from_settings(settings, scan_plates=splates)
            for idx, info in enumerate(iter_):
                emitter.setValue.emit(idx)

            emitter.setLabelText.emit("checking dimensions...")
            emitter.setRange.emit(0, 0)
            QtCore.QCoreApplication.processEvents()

            if len(icontainer.plates) > 0:
                icontainer.set_plate(icontainer.plates[0])
                icontainer.check_dimensions()


        label = ('Please wait until the input structure is scanned\n'
                 'or the structure data loaded...')
        self._dlg = ProgressDialog(label, None, 0, len(scan_plates), self)
        emitter = ProgressObject()
        emitter.setRange.connect(self._dlg.setRange)
        emitter.setValue.connect(self._dlg.setValue)
        emitter.setLabelText.connect(self._dlg.setLabelText)

        try:
            func = lambda: load(emitter, imagecontainer,
                                self._settings, scan_plates)
            self._dlg.exec_(func, (emitter, ))
        except ImportError as e:
            # structure file from versions older than 1.3 contain pdk which is
            # removed
            if 'pdk' in str(e):
                QMessageBox.critical(self, "Error",
                                     ("Your structure file format is outdated.\n"
                                      "You have to rescan the plate(s)"))
            else:
                QMessageBox.critical(self, "Error", traceback.format_exc())
            return
        except Exception as e:
            QMessageBox.critical(self, "Error", str(e))


        try: # I hate lookup tables!
            self._tab_lookup['Cluster'][1].set_imagecontainer(imagecontainer)
        except KeyError:
            pass

        if len(imagecontainer.plates) > 0:
            channels = imagecontainer.channels

            # do not report value changes to the main window
            self._settings.set_notify_change(False)

            self.set_image_crop_size()

            problems = []
            for prefix in ['primary', 'secondary', 'tertiary']:
                trait = self._settings.get_trait(SECTION_NAME_OBJECTDETECTION,
                                                 '%s_channelid' % prefix)
                if trait.set_list_data(channels) is None:
                    problems.append(prefix)
                self._tabs[1].get_widget('%s_channelid' % prefix).update()

            # report problems about a mismatch between channel IDs found in the data
            # and specified by the user
            if len(problems) > 0:
                # a mismatch between settings and data will cause changed settings
                self.settings_changed(True)

            trait = self._settings.get_trait(SECTION_NAME_EVENT_SELECTION,
                                             'duration_unit')

            # allow time-base tracking durations only if time-stamp
            # information is present
            meta_data = imagecontainer.get_meta_data()
            if meta_data.has_timestamp_info:
                result = trait.set_list_data(TimeConverter.units)
            else:
                result = trait.set_list_data([TimeConverter.FRAMES])
            if result is None:
                QMessageBox.critical(self, "Could not set tracking duration units",
                                     ("The tracking duration units selected to match the "
                                      "load data. Please check your settings."))
                # a mismatch between settings and data will cause changed settings
                self.settings_changed(True)

            # activate change notification again
            self._settings.set_notify_change(True)

#.........这里部分代码省略.........
开发者ID:xiwei-zhang,项目名称:cecog,代码行数:101,代码来源:main.py

示例15: ClusterDisplay


#.........这里部分代码省略.........
            for name in dirs:
                try:
                    os.rmdir(os.path.join(root, name))
                except OSError:
                    pass

    @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)
开发者ID:CellCognition,项目名称:cecog,代码行数:67,代码来源:cluster.py


注:本文中的cecog.gui.progressdialog.ProgressDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。