def __init__(self, *args, **kw):
     super(SampleBrowserModel, self).__init__(*args, **kw)
     prefid = 'pychron.browser'
     bind_preference(self.search_criteria, 'recent_hours',
                     '{}.recent_hours'.format(prefid))
     bind_preference(self.search_criteria, 'reference_hours_padding',
                     '{}.reference_hours_padding'.format(prefid))
Example #2
0
    def __init__(self, bind=True, *args, **kw):
        super(DVCPersister, self).__init__(*args, **kw)
        if bind:
            bind_preference(self, 'use_uuid_path_name',
                            'pychron.experiment.use_uuid_path_name')

        self._load_arar_mapping()
Example #3
0
    def start(self):
        # if self.managers:
        from pychron.initializer import Initializer

        dp = DevicePreferences()
        afh = self.application.preferences.get(
            'pychron.hardware.auto_find_handle')
        awh = self.application.preferences.get(
            'pychron.hardware.auto_write_handle')
        if afh is not None:
            toBool = lambda x: True if x == 'True' else False
            dp.serial_preference.auto_find_handle = toBool(afh)
            dp.serial_preference.auto_write_handle = toBool(awh)

        ini = Initializer(device_prefs=dp)
        for m in self.managers:
            ini.add_initialization(m)

        # any loaded managers will be registered as services
        if not ini.run(application=self.application):
            self.application.exit()
            return

        # create the hardware server
        rhm = self.application.get_service(RemoteHardwareManager)
        bind_preference(rhm, 'enable_hardware_server',
                        'pychron.hardware.enable_hardware_server')
        bind_preference(rhm, 'enable_directory_server',
                        'pychron.hardware.enable_directory_server')

        rhm.bootstrap()
Example #4
0
 def bind_preferences(self, pref_id):
     super(FusionsLaserManager, self).bind_preferences(pref_id)
     bind_preference(self, 'recording_zoom',
                     '{}.recording_zoom'.format(pref_id)
     )
     bind_preference(self, 'record_brightness',
                     '{}.record_brightness'.format(pref_id)
     )
Example #5
0
    def activated(self):
        bind_preference(self, 'check_for_changes',
                        'pychron.dvc.repository.check_for_changes')

        self.refresh_local_names()
        if self.check_for_changes:
            if self.confirmation_dialog('Check all Repositories for changes'):
                self.find_changes()
Example #6
0
 def bind_preferences(self, pref_id):
     self.debug('binding preferences')
     super(FusionsLaserManager, self).bind_preferences(pref_id)
     bind_preference(self, 'recording_zoom',
                     '{}.recording_zoom'.format(pref_id))
     bind_preference(self, 'record_brightness',
                     '{}.record_brightness'.format(pref_id))
     self.debug('preferences bound')
Example #7
0
    def bind_preferences(self):
        pref_id = 'pychron.spectrometer'
        bind_preference(self.spectrometer, 'send_config_on_startup',
                        '{}.send_config_on_startup'.format(pref_id))

        bind_preference(self.spectrometer.magnet,
                        'confirmation_threshold_mass',
                        '{}.confirmation_threshold_mass'.format(pref_id))
Example #8
0
    def bind_preferences(self):
        from apptools.preferences.preference_binding import bind_preference

        prefid = 'pychron.spectrometer'
        bind_preference(self, 'use_local_archive',
                        '{}.use_local_mftable_archive'.format(prefid))
        bind_preference(self, 'use_db_archive',
                        '{}.use_db_mftable_archive'.format(prefid))
Example #9
0
    def _bind_preferences(self):

        prefid = 'pychron.dvc'
        for attr in ('meta_repo_name', 'organization', 'github_user', 'github_password', 'default_team'):
            bind_preference(self, attr, '{}.{}'.format(prefid, attr))

        prefid = 'pychron.dvc.db'
        for attr in ('username', 'password', 'name', 'host'):
            bind_preference(self.db, attr, '{}.{}'.format(prefid, attr))
Example #10
0
    def __init__(self, *args, **kw):
        super(LabnumberEntry, self).__init__(*args, **kw)

        #self.labnumber_generator = LabnumberGenerator(db=self.db)

        bind_preference(self, 'irradiation_prefix',
                        'pychron.experiment.irradiation_prefix')
        bind_preference(self, 'monitor_name',
                        'pychron.experiment.monitor_name')
Example #11
0
    def _client_factory(self):
        client = DashboardClient()
        bind_preference(client, 'host', 'pychron.dashboard.client.host')
        bind_preference(client, 'port', 'pychron.dashboard.client.port')

        client.connect()
        client.load_configuration()
        client.listen()

        return client
    def __init__(self, username=None, *args, **kw):
        if username:
            self.id = '{}.{}'.format(self.id, username)
            self.name = '{} - {}'.format(self.name, username)
            self.username = username
            globalv.username = username

        super(PychronApplication, self).__init__(*args, **kw)

        bind_preference(self, 'use_login', 'pychron.general.use_login')
        bind_preference(self, 'multi_user', 'pychron.general.multi_user')
    def bind_preferences(self):
        super(IsotopeDatabaseManager, self).bind_preferences()

        prefid = 'pychron.vcs'
        bind_preference(self, 'use_vcs', '{}.use_vcs'.format(prefid))
        self._use_vcs_changed()

        prefid = 'pychron.offline'
        bind_preference(self, 'use_offline_database',
                        '{}.use_offline_database'.format(prefid))
        self._use_offline_database_changed()
Example #14
0
    def activated(self):
        #         self.manager.tray = 'A'
        #         self.manager.irradiation = 'NM-251'
        #         self.manager.level = 'H'
        #         self.manager.labnumber = '61311'

        if self.manager.setup():
            bind_preference(self, 'save_directory',
                            'pychron.loading.save_directory')
        else:
            do_later(self.window.close)
Example #15
0
    def activated(self):

        bind_preference(self, 'auto_add_project_repository', 'pychron.entry.sample.auto_add_project_repository')

        self.refresh_pis = True
        self.refresh_materials = True
        self.refresh_projects = True
        self.refresh_grainsizes = True
        self.dvc.create_session()
        self.sample_edit_model.dvc = self.dvc
        self._load_lithologies()
Example #16
0
    def activated(self):
        bind_preference(self, 'check_for_changes', 'pychron.dvc.repository.check_for_changes')
        # self._preference_binder('pychron.dvc.connection', ('organization',))
        # prefid = 'pychron.dvc.connection'

        # bind_preference(self, 'favorites', '{}.favorites'.format(prefid))

        # self._preference_binder('pychron.github', ('oauth_token',))
        self.refresh_local_names()
        if self.check_for_changes:
            if self.confirmation_dialog('Check all Repositories for changes'):
                self.find_changes()
Example #17
0
    def bind_preferences(self):
        if self.db is None:
            self.db = self._db_factory()

        prefid = 'pychron.database'
        bind_preference(self.db, 'kind', '{}.kind'.format(prefid))
        if self.db.kind == 'mysql':
            bind_preference(self.db, 'host', '{}.host'.format(prefid))
            bind_preference(self.db, 'username', '{}.username'.format(prefid))
            bind_preference(self.db, 'password', '{}.password'.format(prefid))

        bind_preference(self.db, 'name', '{}.db_name'.format(prefid))
Example #18
0
    def __init__(self, *args, **kw):
        super(SwitchRenamer, self).__init__(*args, **kw)

        if not self.valves_path:
            bind_preference(self, 'valves_path',
                            'pychron.extraction_line.valves_path')

        if not self.script_root:
            from pychron.paths import paths
            self.script_root = paths.scripts_dir

        self._load_descriptions()
    def bind_preferences(self):
        from apptools.preferences.preference_binding import bind_preference

        bind_preference(self, 'check_master_owner',
                        'pychron.extraction_line.check_master_owner')
        bind_preference(self, 'use_network',
                        'pychron.extraction_line.use_network')
        bind_preference(self.network, 'inherit_state',
                        'pychron.extraction_line.inherit_state')

        bind_preference(self, 'display_volume', 'pychron.extraction_line.display_volume')
        bind_preference(self, 'volume_key', 'pychron.extraction_line.volume_key')
Example #20
0
    def activated(self):
        # self.manager.tray = 'bat'
        # self.manager.irradiation = 'NM-256'
        # self.manager.level = 'A'
        # self.manager.labnumber = '23261'
        # self.manager.load_name = '4'

        if self.manager.verify_database_connection(inform=True):
            if self.manager.load():
                self.manager.username = globalv.username
                if self.manager.setup():
                    bind_preference(self.manager, 'save_directory',
                                    'pychron.loading.save_directory')
Example #21
0
    def bind_preferences(self):
        prefid = 'pychron.massspec.database'

        bind_preference(self, 'massspec_enabled', '{}.enabled'.format(prefid))
        if self.massspec_enabled:
            bind_preference(self.secondarystore.db, 'name',
                            '{}.name'.format(prefid))
            bind_preference(self.secondarystore.db, 'host',
                            '{}.host'.format(prefid))
            bind_preference(self.secondarystore.db, 'username',
                            '{}.username'.format(prefid))
            bind_preference(self.secondarystore.db, 'password',
                            '{}.password'.format(prefid))
Example #22
0
    def _main_db_default(self):
        from apptools.preferences.preference_binding import bind_preference

        db = IsotopeAdapter()
        prefid = 'pychron.database'
        bind_preference(db, 'kind', '{}.kind'.format(prefid))
        if db.kind == 'mysql':
            bind_preference(db, 'host', '{}.host'.format(prefid))
            bind_preference(db, 'username', '{}.username'.format(prefid))
            bind_preference(db, 'password', '{}.password'.format(prefid))

        bind_preference(db, 'name', '{}.db_name'.format(prefid))
        return db
    def bind_preferences(self):

        prefid = 'pychron.extraction_line'

        attrs = ('canvas_path', 'canvas_config_path', 'valves_path',
                 'use_hardware_update', 'hardware_update_period',
                 'check_master_owner', 'use_network')

        for attr in attrs:
            try:
                bind_preference(self, attr, '{}.{}'.format(prefid, attr))
            except BaseException, e:
                print attr, e
    def start(self):
        prefix = 'pychron.psychodrama'
        bind_preference(self, 'path', '{}.path'.format(prefix))

        try:
            os.unlink(self.path)
        except OSError:
            pass

        self._alive = True

        t = Thread(target=self._listen)
        t.setDaemon(True)
        t.start()
Example #25
0
    def activated(self):
        self.load_projects()

        db = self.manager.db
        with db.session_ctx():
            self._load_mass_spectrometers()
            self._load_analysis_types()
            self._load_extraction_devices()

        self.datasource_url=db.datasource_url
        # self._set_db()

        bind_preference(self.search_criteria, 'recent_hours', 'pychron.processing.recent_hours')
        self.load_browser_selection()
Example #26
0
    def initialize(self, *args, **kw):
        ret = super(NGXController, self).initialize(*args, **kw)
        if ret:
            resp = self.read()

            bind_preference(self, 'username',
                            'pychron.spectrometer.ngx.username')
            bind_preference(self, 'password',
                            'pychron.spectrometer.ngx.password')

            if resp:
                self.info('NGX-{}'.format(resp))
                self.ask('Login {},{}'.format(self.username, self.password))

            return True
Example #27
0
    def bind_preferences(self):
        from apptools.preferences.preference_binding import bind_preference

        prefid = 'pychron.massspec.database'
        bind_preference(self, 'host', '{}.host'.format(prefid))
        bind_preference(self, 'username', '{}.username'.format(prefid))
        bind_preference(self, 'password', '{}.password'.format(prefid))
        bind_preference(self, 'name', '{}.name'.format(prefid))
Example #28
0
 def bind_preferences(self):
     try:
         bind_preference(self, 'host', 'pychron.media_server.host')
         bind_preference(self, 'port', 'pychron.media_server.port')
         bind_preference(self, 'use_cache', 'pychron.media_server.use_cache')
         bind_preference(self, 'cache_dir', 'pychron.media_server.cache_dir')
     except AttributeError:
         pass
Example #29
0
    def __init__(self, *args, **kw):
        super(Emailer, self).__init__(*args, **kw)

        bind_preference(self, 'server_username', 'pychron.email.server_username')
        bind_preference(self, 'server_password', 'pychron.email.server_password')
        bind_preference(self, 'server_host', 'pychron.email.server_host')
        bind_preference(self, 'server_port', 'pychron.email.server_port')
        if not self.server_port:
            self.server_port = 587
Example #30
0
    def _analysis_table_default(self):
        at = AnalysisTable(dvc=self.dvc)
        at.on_trait_change(self._analysis_set_changed, 'analysis_set')
        # at.load()
        prefid = 'pychron.browser'
        bind_preference(at, 'max_history', '{}.max_history'.format(prefid))

        bind_preference(at.tabular_adapter, 'unknown_color',
                        '{}.unknown_color'.format(prefid))
        bind_preference(at.tabular_adapter, 'blank_color',
                        '{}.blank_color'.format(prefid))
        bind_preference(at.tabular_adapter, 'air_color',
                        '{}.air_color'.format(prefid))

        bind_preference(at.tabular_adapter, 'use_analysis_colors',
                        '{}.use_analysis_colors'.format(prefid))
        return at