コード例 #1
0
ファイル: results_view.py プロジェクト: NMGRL/pychron
    def closed(self, info, is_ok):
        import sys

        if not self._auto_closed and not is_ok:
            if confirm(info.ui.control, 'Are you sure you want to Quit?') == YES:
                self.model.info('User quit because of Startup fail')

                sys.exit()
        else:
            if not self.model.ok_close():
                if confirm(info.ui.control, 'Pychron is not communicating with a Spectrometer.\n'
                                            'Are you sure you want to enter '
                                            'Spectrometer Simulation mode?') != YES:
                    sys.exit()
コード例 #2
0
    def perform(self, event):
        ok = YES
        if len(self.task.window.application.windows) == 1:
            ok = confirm(self.task.window.control, message='Quit Pychron?')

        if ok == YES:
            self.task.window.close()
コード例 #3
0
 def _delete_decay_constant_fired(self):
     dn = self.decay_constant_name
     result = confirm(None, 'Are you sure you want to remove "{}"'.format(dn))
     if result == YES:
         self.decay_constant_names.remove(dn)
         self.decay_constant_entries.pop(dn)
         self.decay_constant_name = self.decay_constant_names[-1] if self.decay_constant_names else NULL_STR
コード例 #4
0
ファイル: actions.py プロジェクト: stephen-e-cox/pychron
    def perform(self, event):
        ok = YES
        if len(self.task.window.application.windows) == 1:
            ok = confirm(self.task.window.control, message='Quit Pychron?')

        if ok == YES:
            self.task.window.close()
コード例 #5
0
ファイル: nodes.py プロジェクト: NMGRL/pychron
    def run(self, state):
        # from the list of unknowns in the current state
        # assemble the <sample>.in file
        # for use with files_py
        roots = []
        state.mdd_workspace = MDDWorkspace()
        for gid, unks in groupby_group_id(state.unknowns):
            unks = list(unks)
            unk = unks[0]
            name = '{}-{:02n}'.format(unk.identifier, unk.aliquot)
            root = os.path.join(paths.mdd_data_dir, name)
            if os.path.isdir(root):
                if confirm(None, '{} already exists. Backup existing?'.format(root)) == YES:
                    head, tail = os.path.split(root)
                    dest = os.path.join(head, '~{}'.format(tail))
                    if os.path.isdir(dest):
                        shutil.rmtree(dest)

                    shutil.move(root, dest)

            if not os.path.isdir(root):
                os.mkdir(root)

            roots.append(root)
            ag = StepHeatAnalysisGroup(analyses=unks)
            with open(os.path.join(root, '{}.in'.format(name)), 'w') as wfile:
                step = 0
                for unk in ag.analyses:
                    if unk.age > 0:
                        cum39 = ag.cumulative_ar39(step)
                        line = self._assemble(step, unk, cum39)
                        wfile.write(line)
                        step += 1

        state.mdd_workspace.roots = roots
コード例 #6
0
ファイル: actions.py プロジェクト: NMGRL/pychron
 def perform(self, event):
     from pychron.dvc.work_offline import switch_to_offline_database
     app = event.task.window.application
     switch_to_offline_database(app.preferences)
     ret = confirm(None, 'You are now using the offline database. Restart now for changes to take effect')
     if ret == YES:
         restart()
コード例 #7
0
 def _delete_decay_constant_fired(self):
     dn = self.decay_constant_name
     result = confirm(None, 'Are you sure you want to remove "{}"'.format(dn))
     if result == YES:
         self.decay_constant_names.remove(dn)
         self.decay_constant_entries.pop(dn)
         self.decay_constant_name = self.decay_constant_names[-1] if self.decay_constant_names else NULL_STR
コード例 #8
0
ファイル: actions.py プロジェクト: NMGRL/pychron
 def perform(self, event):
     from pychron.paths import paths
     p = paths.hidden_path('analysis_sets')
     if os.path.isfile(p):
         if confirm(None, 'Are you sure you want to clear the Analysis Sets?') == YES:
             os.remove(p)
     else:
         information(None, 'No Analysis Sets to remove')
コード例 #9
0
    def closed(self, info, is_ok):
        import sys

        if not self._auto_closed and not is_ok:
            if confirm(info.ui.control,
                       'Are you sure you want to Quit?') == YES:
                self.model.info('User quit because of Startup fail')

                sys.exit()
        else:
            if not self.model.ok_close():
                if confirm(
                        info.ui.control,
                        'Pychron is not communicating with a Spectrometer.\n'
                        'Are you sure you want to enter '
                        'Spectrometer Simulation mode?') != YES:
                    sys.exit()
コード例 #10
0
 def perform(self, event):
     from pychron.paths import paths
     p = paths.hidden_path('analysis_sets')
     if os.path.isfile(p):
         if confirm(None, 'Are you sure you want to clear the Analysis Sets?') == YES:
             os.remove(p)
     else:
         information(None, 'No Analysis Sets to remove')
コード例 #11
0
def set_interpreted_age(dvc, ias):
    repos = dvc.get_local_repositories()
    liths, groups, classes, types = get_lithology_values()
    for ia in ias:
        ia.lithology_classes = classes
        ia.lithology_groups = groups
        ia.lithology_types = types
        ia.lithologies = liths

    model = InterpretedAgeFactoryModel(items=ias, selected=ias[:1], dvc=dvc)
    iaf = InterpretedAgeFactoryView(model=model, repository_identifiers=repos)

    while 1:
        info = iaf.edit_traits()
        if info.result:
            no_lat_lon = []
            ias = [ia for ia in ias if ia.use]
            for ia in ias:
                if not ia.latitude and not ia.longitude:
                    no_lat_lon.append('{} ({})'.format(ia.name, ia.identifier))

            if no_lat_lon:
                n = ','.join(no_lat_lon)
                if not confirm(
                        None,
                        'No Lat/Lon. entered for {}. Are you sure you want to continue without setting a '
                        'Lat/Lon?'.format(n)) == YES:
                    continue

            ris = []
            for rid, iass in groupby_key(ias, key='repository_identifier'):
                if dvc.add_interpreted_ages(rid, iass):
                    ris.append(rid)

            if ris:
                if confirm(
                        None, 'Would you like to share changes to {}?'.format(
                            ','.join(ris))) == YES:
                    for rid in ris:
                        dvc.push_repository(rid)
                    information(None, 'Sharing changes complete')

            break
        else:
            break
コード例 #12
0
    def close(self, info, is_ok):
        if info.object.dirty:
            if not confirm(
                    None,
                    'You have unsaved changes. Are you sure you want to continue'
            ) == YES:
                return False

        return True
コード例 #13
0
 def _delete_templates(self, selected_templates):
     confirmed = YES
     if self.interactive:
         num = len(selected_templates)
         msg = f"Delete the {num} selected items?\n\n" \
               f"Once deleted, a template is not recoverable."
         confirmed = confirm(None, msg)
     if confirmed == YES:
         self.model.delete_templates(selected_templates)
         self.selected_plot_templates = []
コード例 #14
0
 def perform(self, event):
     from pychron.dvc.work_offline import switch_to_offline_database
     app = event.task.window.application
     switch_to_offline_database(app.preferences)
     ret = confirm(
         None,
         'You are now using the offline database. Restart now for changes to take effect'
     )
     if ret == YES:
         restart()
コード例 #15
0
ファイル: xlsx_table_writer.py プロジェクト: NMGRL/pychron
    def build(self, groups, path=None, options=None):
        if options is None:
            options = XLSXAnalysisTableWriterOptions()

        self._options = options
        if path is None:
            path = options.path

        self.debug('saving table to {}'.format(path))
        r_mkdir(os.path.dirname(path))

        self._new_workbook(path)

        self._bold = self._workbook.add_format({'bold': True})
        self._superscript = self._workbook.add_format({'font_script': 1})
        self._subscript = self._workbook.add_format({'font_script': 2})
        self._ital = self._workbook.add_format({'italic': True})

        unknowns = groups.get('unknowns')
        if unknowns:
            # make a human optimized table
            unknowns = self._make_human_unknowns(unknowns)

            # make a machine optimized table
        munknowns = groups.get('machine_unknowns')
        if munknowns:
            self._make_machine_unknowns(munknowns)

        airs = groups.get('airs')
        if airs:
            self._make_airs(airs)

        blanks = groups.get('blanks')
        if blanks:
            self._make_blanks(blanks)

        monitors = groups.get('monitors')
        if monitors:
            self._make_monitors(monitors)

        # if not self._options.include_production_ratios:
        #     self._make_irradiations(unknowns)

        if self._options.include_summary_sheet:
            if unknowns:
                self._make_summary_sheet(unknowns)

        self._workbook.close()

        view = self._options.auto_view
        if not view:
            view = confirm(None, 'Table saved to {}\n\nView Table?'.format(path)) == YES

        if view:
            view_file(path, application='Excel')
コード例 #16
0
ファイル: pyscript.py プロジェクト: NMGRL/pychron
    def _cancel_flag_changed(self, v):
        if v:
            from pyface.confirmation_dialog import confirm

            result = confirm(None,
                             'Are you sure you want to cancel {}'.format(self.logger_name),
                             title='Cancel Script')
            if result != 5104:
                self.cancel()
            else:
                self.cancel_flag = False
コード例 #17
0
ファイル: pyscript.py プロジェクト: ael-noblegas/pychron
    def _cancel_flag_changed(self, v):
        if v:
            from pyface.confirmation_dialog import confirm

            result = confirm(None,
                             'Are you sure you want to cancel {}'.format(
                                 self.logger_name),
                             title='Cancel Script')
            if result != 5104:
                self.cancel()
            else:
                self.cancel_flag = False
コード例 #18
0
ファイル: fit.py プロジェクト: ael-noblegas/pychron
    def check_refit(self, unks):
        unks = self._get_valid_unknowns(unks)
        for ui in unks:
            try:
                if self._check_refit(ui):
                    break

            except RefitException:
                return False
        else:
            if confirm(None, self._refit_message) == YES:
                return True
コード例 #19
0
def check_dependencies(debug):
    """
        check the dependencies and install if possible/required
    """
    # suppress dependency checks temporarily
    return True

    with open('ENV.txt', 'r') as fp:
        env = fp.read().strip()

    ret = False
    logger.info('================ Checking Dependencies ================')
    for npkg, req in (
        ('uncertainties', '2.1'),
        ('pint', '0.5'),
            # ('fant', '0.1')
    ):
        try:
            pkg = __import__(npkg)
            ver = pkg.__version__
        except ImportError:
            if confirm(
                    None,
                    '"{}" is required. Attempt to automatically install?'.
                    format(npkg)):
                if not install_package(pkg, env, debug):
                    warning(
                        None,
                        'Failed installing "{}". Try to install manually'.
                        format(npkg))
                    break

            else:
                warning(
                    None, 'Install "{}" package. required version>={} '.format(
                        npkg, req))
                break

        vargs = ver.split('.')
        maj = int(vargs[0])
        if maj < int(float(req)):
            warning(
                None,
                'Update "{}" package. your version={}. required version>={} '.
                format(npkg, maj, req))
            break
        logger.info('{:<15s} >={:<5s} satisfied. Current ver: {}'.format(
            npkg, req, ver))
    else:
        ret = True

    logger.info('=======================================================')
    return ret
コード例 #20
0
ファイル: fit.py プロジェクト: NMGRL/pychron
    def check_refit(self, unks):
        unks = self._get_valid_unknowns(unks)
        for ui in unks:
            try:
                if self._check_refit(ui):
                    break

            except RefitException:
                return False
        else:
            if confirm(None, self._refit_message) == YES:
                return True
コード例 #21
0
def edit_initialization():
    # ip = InitializationParser()

    pev = InitializationEditView()
    pev.model = get_initialization_model()

    # pev.model = model
    # pev.plugin_tree = rtree
    info = pev.edit_traits()
    if info.result:
        pev.model.save()
        if pev.model.is_dirty():
            return confirm(None, 'Restart for changes to take effect. Restart now?')==YES
コード例 #22
0
ファイル: controller.py プロジェクト: NMBGMR/wellpy
    def apply_offset(self, info):
        if not self.model.has_selection():
            ret = confirm(None, 'No Range selected? Apply to entire dataset')
            if ret != YES:
                return

        v = View(Item('controller.offset_kind', label='Kind'),
                 Item('controller.offset', enabled_when='kind="Constant"'),
                 title='Set Offset',
                 buttons=['OK', 'Cancel'],
                 kind='livemodal')
        info = self.edit_traits(view=v)
        if info.result:
            self.model.apply_offset(self.offset_kind, self.offset)
コード例 #23
0
def edit_initialization():
    # ip = InitializationParser()

    pev = InitializationEditView()
    pev.load_defaults()
    pev.model = get_initialization_model()

    # pev.model = model
    # pev.plugin_tree = rtree
    # do_after(1000, pev.trait_set, default='Experiment CO2')
    info = pev.edit_traits()
    if info.result:
        pev.save()
        if pev.model.is_dirty():
            return confirm(None, 'Restart for changes to take effect. Restart now?') == YES
コード例 #24
0
def edit_initialization():
    # ip = InitializationParser()

    pev = InitializationEditView()
    pev.load_defaults()
    pev.model = get_initialization_model()

    # pev.model = model
    # pev.plugin_tree = rtree
    # do_after(1000, pev.trait_set, default='Experiment CO2')
    info = pev.edit_traits()
    if info.result:
        pev.save()
        if pev.model.is_dirty():
            return confirm(None, "Restart for changes to take effect. Restart now?") == YES
コード例 #25
0
ファイル: tasks_plugin.py プロジェクト: NMGRL/pychron
 def perform(self, event):
     app = event.task.window.application
     if globalv.username == 'dev' and globalv.dev_confirm_exit:
         window = event.task.window
         dialog = ConfirmApplicationExit()
         ui = dialog.edit_traits(parent=window.control, kind='livemodal')
         if not ui.result or not dialog.validate():
             return
     else:
         prefs = app.preferences
         if prefs.get('pychron.general.confirm_quit'):
             ret = confirm(None, 'Are you sure you want to Quit?')
             if ret == NO:
                 return
     app.exit(force=True)
コード例 #26
0
ファイル: tasks_plugin.py プロジェクト: ael-noblegas/pychron
 def perform(self, event):
     app = event.task.window.application
     if globalv.username == 'dev' and globalv.dev_confirm_exit:
         window = event.task.window
         dialog = ConfirmApplicationExit()
         ui = dialog.edit_traits(parent=window.control, kind='livemodal')
         if not ui.result or not dialog.validate():
             return
     else:
         prefs = app.preferences
         if prefs.get('pychron.general.confirm_quit'):
             ret = confirm(None, 'Are you sure you want to Quit?')
             if ret == NO:
                 return
     app.exit(force=True)
コード例 #27
0
    def remove_editor(self, editor):
        """ Removes an editor from the pane.
        """
        editor_widget = editor.control.parent()
        if editor.dirty:
            ret = confirmation_dialog.confirm(editor_widget,
                                              'Unsaved changes to "{}". '
                                              'Do you want to continue'.format(editor.name))
            if ret == NO:
                return

        self.editors.remove(editor)
        self.control.remove_editor_widget(editor_widget)
        editor.editor_area = None
        if not self.editors:
            self.active_editor = None
コード例 #28
0
    def remove_editor(self, editor):
        """ Removes an editor from the pane.
        """
        editor_widget = editor.control.parent()
        if editor.dirty:
            ret = confirmation_dialog.confirm(
                editor_widget, 'Unsaved changes to "{}". '
                'Do you want to continue'.format(editor.name))
            if ret == NO:
                return

        self.editors.remove(editor)
        self.control.remove_editor_widget(editor_widget)
        editor.editor_area = None
        if not self.editors:
            self.active_editor = None
コード例 #29
0
    def build(self,
              path=None,
              unknowns=None,
              airs=None,
              blanks=None,
              monitors=None,
              options=None):
        if options is None:
            options = XLSXTableWriterOptions()

        self._options = options
        if path is None:
            path = options.path
        self.debug('saving table to {}'.format(path))
        self._workbook = xlsxwriter.Workbook(add_extension(path, '.xlsx'),
                                             {'nan_inf_to_errors': True})
        self._bold = self._workbook.add_format({'bold': True})
        self._superscript = self._workbook.add_format({'font_script': 1})
        self._subscript = self._workbook.add_format({'font_script': 2})

        if unknowns:
            self._make_unknowns(unknowns)

        if airs:
            self._make_airs(airs)

        if blanks:
            self._make_blanks(blanks)

        if monitors:
            self._make_monitors(monitors)

        if not self._options.include_production_ratios:
            self._make_irradiations(unknowns)

        if self._options.include_summary_sheet:
            self._make_summary_sheet(unknowns)

        self._workbook.close()

        view = self._options.auto_view
        if not view:
            view = confirm(
                None, 'Table saved to {}\n\nView Table?'.format(path)) == YES

        if view:
            view_file(path, application='Excel')
コード例 #30
0
    def perform(self, event):
        from pyface.file_dialog import FileDialog
        dialog = FileDialog(action='save as', default_filename='IrradiationTemplate.xls')

        from pyface.constant import OK
        if dialog.open() == OK:
            path = dialog.path
            if path:
                from pychron.core.helpers.filetools import add_extension
                path = add_extension(path, '.xls')

                from pychron.entry.loaders.irradiation_template import IrradiationTemplate
                i = IrradiationTemplate()
                i.make_template(path)

                from pyface.confirmation_dialog import confirm
                if confirm(None, 'Template saved to {}.\n\nWould you like to open the template?'):
                    from pychron.core.helpers.filetools import view_file
                    application = 'Microsoft Office 2011/Microsoft Excel'
                    view_file(path, application=application)
コード例 #31
0
ファイル: helpers.py プロジェクト: NMGRL/pychron
def check_dependencies(debug):
    """
        check the dependencies and install if possible/required
    """
    # suppress dependency checks temporarily
    return True

    with open("ENV.txt", "r") as fp:
        env = fp.read().strip()

    ret = False
    logger.info("================ Checking Dependencies ================")
    for npkg, req in (
        ("uncertainties", "2.1"),
        ("pint", "0.5"),
        # ('fant', '0.1')
    ):
        try:
            pkg = __import__(npkg)
            ver = pkg.__version__
        except ImportError:
            if confirm(None, '"{}" is required. Attempt to automatically install?'.format(npkg)):
                if not install_package(pkg, env, debug):
                    warning(None, 'Failed installing "{}". Try to install manually'.format(npkg))
                    break

            else:
                warning(None, 'Install "{}" package. required version>={} '.format(npkg, req))
                break

        vargs = ver.split(".")
        maj = int(vargs[0])
        if maj < int(float(req)):
            warning(None, 'Update "{}" package. your version={}. required version>={} '.format(npkg, maj, req))
            break
        logger.info("{:<15s} >={:<5s} satisfied. Current ver: {}".format(npkg, req, ver))
    else:
        ret = True

    logger.info("=======================================================")
    return ret
コード例 #32
0
    def perform(self, event):
        from git import Repo
        from git.exc import InvalidGitRepositoryError
        from pychron.paths import paths
        remote = 'origin'
        branch = 'master'
        repos = []
        for d in os.listdir(paths.repository_dataset_dir):
            if d.startswith('.') or d.startswith('~'):
                continue

            try:
                r = Repo(repository_path(d))
            except InvalidGitRepositoryError:
                continue
            repos.append(r)

        n = len(repos)
        pd = myProgressDialog(max=n - 1, can_cancel=True, can_ok=False)
        pd.open()
        shared = False
        for r in repos:
            pd.change_message('Fetch {}'.format(os.path.basename(
                r.working_dir)))
            c = r.git.log('{}/{}..HEAD'.format(remote, branch), '--oneline')
            if c:

                r.git.pull()

                d = os.path.basename(r.working_dir)
                if confirm(None,
                           'Share changes made to {}.\n\n{}'.format(d,
                                                                    c)) == YES:
                    r.git.push(remote, branch)
                    shared = True

        msg = 'Changes successfully shared' if shared else 'No changes to share'
        information(None, msg)
コード例 #33
0
ファイル: actions.py プロジェクト: NMGRL/pychron
    def perform(self, event):
        from git import Repo
        from git.exc import InvalidGitRepositoryError
        from pychron.paths import paths
        remote = 'origin'
        branch = 'master'
        repos = []
        for d in os.listdir(paths.repository_dataset_dir):
            if d.startswith('.') or d.startswith('~'):
                continue

            try:
                r = Repo(repository_path(d))
            except InvalidGitRepositoryError:
                continue
            repos.append(r)

        n = len(repos)
        pd = myProgressDialog(max=n - 1,
                              can_cancel=True,
                              can_ok=False)
        pd.open()
        shared = False
        for r in repos:
            pd.change_message('Fetch {}'.format(os.path.basename(r.working_dir)))
            c = r.git.log('{}/{}..HEAD'.format(remote, branch), '--oneline')
            if c:

                r.git.pull()

                d = os.path.basename(r.working_dir)
                if confirm(None, 'Share changes made to {}.\n\n{}'.format(d, c)) == YES:
                    r.git.push(remote, branch)
                    shared = True

        msg = 'Changes successfully shared' if shared else 'No changes to share'
        information(None, msg)
コード例 #34
0
    def run(self, state):
        # from the list of unknowns in the current state
        # assemble the <sample>.in file
        # for use with files_py
        roots = []
        state.mdd_workspace = MDDWorkspace()
        for gid, unks in groupby_group_id(state.unknowns):
            unks = list(unks)
            unk = unks[0]
            name = '{}-{:02n}'.format(unk.identifier, unk.aliquot)
            root = os.path.join(paths.mdd_data_dir, name)
            if os.path.isdir(root):
                if confirm(None, '{} already exists. Backup existing?'.format(
                        root)) == YES:
                    head, tail = os.path.split(root)
                    dest = os.path.join(head, '~{}'.format(tail))
                    if os.path.isdir(dest):
                        shutil.rmtree(dest)

                    shutil.move(root, dest)

            if not os.path.isdir(root):
                os.mkdir(root)

            roots.append(root)
            ag = StepHeatAnalysisGroup(analyses=unks)
            with open(os.path.join(root, '{}.in'.format(name)), 'w') as wfile:
                step = 0
                for unk in ag.analyses:
                    if unk.age > 0:
                        cum39 = ag.cumulative_ar39(step)
                        line = self._assemble(step, unk, cum39)
                        wfile.write(line)
                        step += 1

        state.mdd_workspace.roots = roots
コード例 #35
0
ファイル: actions.py プロジェクト: stephen-e-cox/pychron
    def perform(self, event):
        from pyface.file_dialog import FileDialog
        dialog = FileDialog(action='save as',
                            default_filename='IrradiationTemplate.xls')

        from pyface.constant import OK
        if dialog.open() == OK:
            path = dialog.path
            if path:
                from pychron.core.helpers.filetools import add_extension
                path = add_extension(path, '.xls')

                from pychron.entry.loaders.irradiation_template import IrradiationTemplate
                i = IrradiationTemplate()
                i.make_template(path)

                from pyface.confirmation_dialog import confirm
                if confirm(
                        None,
                        'Template saved to {}.\n\nWould you like to open the template?'
                ):
                    from pychron.core.helpers.filetools import view_file
                    application = 'Microsoft Office 2011/Microsoft Excel'
                    view_file(path, application=application)
コード例 #36
0
ファイル: find.py プロジェクト: ael-noblegas/pychron
    def _run_group(self, state, gid, unknowns):
        atypes = [ai.lower().replace(' ', '_') for ai in self.analysis_types]
        kw = dict(extract_devices=self.extract_device
                  if self.use_extract_device else '',
                  mass_spectrometers=self.mass_spectrometer
                  if self.use_mass_spectrometer else '',
                  make_records=False)

        while 1:
            if self.load_name and self.load_name != NULL_STR:
                refs = self.dvc.find_references_by_load(
                    self.load_name, atypes, **kw)
                if refs:
                    times = sorted([ai.rundate for ai in refs])
            else:
                times = sorted([ai.rundate for ai in unknowns])
                refs = self.dvc.find_references(times,
                                                atypes,
                                                hours=self.threshold,
                                                **kw)

            if not refs:
                if confirm(
                        None,
                        'No References Found. Would you like to try different search criteria?'
                ) == YES:
                    if self.configure():
                        continue
                    else:
                        state.canceled = True
                        return True
                else:
                    if not confirm(
                            None, 'Would you like to search manually?') == YES:
                        state.canceled = True
                    return True
            else:
                break

        if refs:
            if self.use_graphical_filter:
                ed = self.extract_device if self.use_extract_device else ''
                ms = self.mass_spectrometer if self.use_mass_spectrometer else ''

                unknowns.extend(refs)
                model = GraphicalFilterModel(analyses=unknowns,
                                             dvc=self.dvc,
                                             extract_device=ed,
                                             mass_spectrometer=ms,
                                             low_post=times[0],
                                             high_post=times[-1],
                                             threshold=self.threshold,
                                             gid=gid)

                model.setup()
                model.analysis_types = self.analysis_types

                obj = GraphicalFilterView(model=model)
                info = obj.edit_traits(kind='livemodal')
                if info.result:
                    refs = model.get_filtered_selection()
                else:
                    refs = None
                    state.veto = self

            if refs:
                refs = self.dvc.make_analyses(refs)
                state.references = list(refs)
                return True
コード例 #37
0
 def retry(self):
     if confirm(self.progress_bar, 'Retrying the experiment may overwrite existing results.\nAre you sure want to retry?'):
         self.start = True
         return True
     else:
         return False
コード例 #38
0
ファイル: actions.py プロジェクト: MNGRLPychron/pychron
 def perform(self, event):
     from pychron.paths import paths
     if confirm(
             None,
             'Are you sure you want to reset to Factory Default settings'):
         paths.reset_plot_factory_defaults()
コード例 #39
0
 def perform(self, event):
     from pychron.paths import paths
     if confirm(None, 'Are you sure you want to reset to Factory Default settings'):
         paths.reset_plot_factory_defaults()
コード例 #40
0
    def build(self, groups, path=None, options=None):
        if options is None:
            options = XLSXAnalysisTableWriterOptions()

        self._options = options
        if path is None:
            path = options.path

        self.debug('saving table to {}'.format(path))
        r_mkdir(os.path.dirname(path))

        self._new_workbook(path)

        self._bold = self._workbook.add_format({'bold': True})
        self._superscript = self._workbook.add_format({'font_script': 1})
        self._subscript = self._workbook.add_format({'font_script': 2})
        self._bsuperscript = self._workbook.add_format({
            'font_script': 1,
            'bold': True
        })
        self._bsubscript = self._workbook.add_format({
            'font_script': 2,
            'bold': True
        })
        self._ital = self._workbook.add_format({'italic': True})

        unknowns = groups.get('unknowns')
        if unknowns:
            # make a human optimized table
            unknowns = self._make_human_unknowns(unknowns)

            # make a machine optimized table
        munknowns = groups.get('machine_unknowns')
        if munknowns:
            self._make_machine_unknowns(munknowns)

        airs = groups.get('airs')
        if airs:
            self._make_airs(airs)

        blanks = groups.get('blanks')
        if blanks:
            self._make_blanks(blanks)

        monitors = groups.get('monitors')
        if monitors:
            self._make_monitors(monitors)

        # if not self._options.include_production_ratios:
        #     self._make_irradiations(unknowns)

        if self._options.include_summary_sheet:
            if unknowns:
                self._make_summary_sheet(unknowns)

        self._workbook.close()

        view = self._options.auto_view
        if not view:
            view = confirm(
                None, 'Table saved to {}\n\nView Table?'.format(path)) == YES

        if view:
            view_file(path, application='Excel')
コード例 #41
0
def edit_task_extensions(ts):
    e = EditExtensionsView()
    for args in ts:
        e.add_additions(*args)
    e.load()

    nodes = [
        TreeNode(node_for=[ViewModel],
                 icon_open='',
                 children='task_extensions'),
        TETreeNode(node_for=[TaskExtensionModel],
                   auto_open=False,
                   children='additions',
                   label='name',
                   menu=MenuManager(
                       Action(name='Enable All',
                              visible_when='not object.all_enabled',
                              action='set_all_enabled'),
                       Action(name='Disable All',
                              visible_when='object.all_enabled',
                              action='set_all_disabled'))),
        AdditionTreeNode(node_for=[AdditionModel],
                         label='name',
                         menu=MenuManager(
                             Action(name='Enable',
                                    action='set_enabled',
                                    visible_when='not object.enabled'),
                             Action(name='Disable',
                                    visible_when='object.enabled',
                                    action='set_disabled')))
    ]
    tgrp = VGroup(
        UItem('predefined', tooltip='List of Predefined UI configurations'),
        UItem(
            'filter_value',
            tooltip=
            'Filter items by name. Show only items where NAME starts with the specified value'
        ),
        HGroup(
            icon_button_editor('collapse_all', 'collapse'),
            icon_button_editor('expand_all', 'collapse'),
        ),
        UItem(
            'view_model',
            height=-400,
            editor=TreeEditor(
                nodes=nodes,
                # selection_mode='extended',
                hide_root=True,
                selected='selected',
                dclick='dclicked',
                show_disabled=True,
                collapse_all='collapse_all',
                expand_all='expand_all',
                refresh='refresh_needed',
                refresh_all_icons='refresh_all_needed',
                editable=False)))
    dgrp = VGroup(
        UItem(
            'description',
            style='custom',
            # height=-100,
            editor=TextEditor(read_only=True)),
        show_border=True,
        label='Description')

    av = View(VGroup(tgrp, dgrp),
              title='Edit UI',
              width=500,
              height=700,
              resizable=True,
              handler=EEHandler(),
              buttons=['OK', 'Cancel'],
              kind='livemodal')

    # info = e.configure_traits(view=AView)
    info = e.edit_traits(view=av)
    if info.result:
        e.dump()
        return confirm(None, 'Restart?') == YES
コード例 #42
0
ファイル: task_extensions.py プロジェクト: NMGRL/pychron
def edit_task_extensions(ts):
    e = EditExtensionsView()
    for args in ts:
        e.add_additions(*args)
    e.load()

    nodes = [
        TreeNode(node_for=[ViewModel], icon_open="", children="task_extensions"),
        TETreeNode(
            node_for=[TaskExtensionModel],
            auto_open=False,
            children="additions",
            label="name",
            menu=MenuManager(
                Action(name="Enable All", visible_when="not object.all_enabled", action="set_all_enabled"),
                Action(name="Disable All", visible_when="object.all_enabled", action="set_all_disabled"),
            ),
        ),
        AdditionTreeNode(
            node_for=[AdditionModel],
            label="name",
            menu=MenuManager(
                Action(name="Enable", action="set_enabled", visible_when="not object.enabled"),
                Action(name="Disable", visible_when="object.enabled", action="set_disabled"),
            ),
        ),
    ]
    tgrp = VGroup(
        UItem("predefined", tooltip="List of Predefined UI configurations"),
        UItem(
            "filter_value", tooltip="Filter items by name. Show only items where NAME starts with the specified value"
        ),
        HGroup(icon_button_editor("collapse_all", "collapse"), icon_button_editor("expand_all", "collapse")),
        UItem(
            "view_model",
            height=-400,
            editor=TreeEditor(
                nodes=nodes,
                # selection_mode='extended',
                hide_root=True,
                selected="selected",
                dclick="dclicked",
                show_disabled=True,
                collapse_all="collapse_all",
                expand_all="expand_all",
                refresh="refresh_needed",
                refresh_all_icons="refresh_all_needed",
                editable=False,
            ),
        ),
    )
    dgrp = VGroup(
        UItem(
            "description",
            style="custom",
            # height=-100,
            editor=TextEditor(read_only=True),
        ),
        show_border=True,
        label="Description",
    )

    av = View(
        VGroup(tgrp, dgrp),
        title="Edit UI",
        width=500,
        height=700,
        resizable=True,
        handler=EEHandler(),
        buttons=["OK", "Cancel"],
        kind="livemodal",
    )

    # info = e.configure_traits(view=AView)
    info = e.edit_traits(view=av)
    if info.result:
        e.dump()
        return confirm(None, "Restart?") == YES
コード例 #43
0
ファイル: task_extensions.py プロジェクト: NMGRL/pychron
def edit_task_extensions(ts):
    e = EditExtensionsView()
    for args in ts:
        e.add_additions(*args)
    e.load()

    nodes = [TreeNode(node_for=[ViewModel],
                      icon_open='',
                      children='task_extensions'),
             TETreeNode(node_for=[TaskExtensionModel],
                        auto_open=False,
                        children='additions',
                        label='name',
                        menu=MenuManager(Action(name='Enable All',
                                                visible_when='not object.all_enabled',
                                                action='set_all_enabled'),
                                         Action(name='Disable All',
                                                visible_when='object.all_enabled',
                                                action='set_all_disabled'))),
             AdditionTreeNode(node_for=[AdditionModel],
                              label='name',
                              menu=MenuManager(Action(name='Enable',
                                                      action='set_enabled',
                                                      visible_when='not object.enabled'),
                                               Action(name='Disable',
                                                      visible_when='object.enabled',
                                                      action='set_disabled')))]
    tgrp = VGroup(UItem('predefined', tooltip='List of Predefined UI configurations'),
                  UItem('filter_value',
                        tooltip='Filter items by name. Show only items where NAME starts with the specified value'),

                  HGroup(icon_button_editor('collapse_all', 'collapse'),
                         icon_button_editor('expand_all', 'collapse'), ),

                  UItem('view_model',
                        height=-400,
                        editor=TreeEditor(nodes=nodes,
                                          # selection_mode='extended',
                                          hide_root=True,
                                          selected='selected',
                                          dclick='dclicked',
                                          show_disabled=True,
                                          collapse_all='collapse_all',
                                          expand_all='expand_all',
                                          refresh='refresh_needed',
                                          refresh_all_icons='refresh_all_needed',
                                          editable=False)))
    dgrp = VGroup(UItem('description',
                        style='custom',
                        # height=-100,
                        editor=TextEditor(read_only=True)),
                  show_border=True, label='Description')

    av = View(VGroup(tgrp, dgrp),
              title='Edit UI',
              width=500,
              height=700,
              resizable=True,
              handler=EEHandler(),
              buttons=['OK', 'Cancel'],
              kind='livemodal')

    # info = e.configure_traits(view=AView)
    info = e.edit_traits(view=av)
    if info.result:
        e.dump()
        return confirm(None, 'Restart?') == YES