Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# ============= enthought library imports =======================
from envisage.ui.tasks.preferences_pane import PreferencesPane
from traits.api import Str, Float, Password, Bool
from traitsui.api import View, Item
from pychron.core.pychron_traits import BorderHGroup, BorderVGroup
from pychron.envisage.tasks.base_preferences_helper import BasePreferencesHelper
class SampleEntryPreferences(BasePreferencesHelper):
preferences_path = 'pychron.entry.sample'
auto_add_project_repository = Bool
class SampleEntryPreferencesPane(PreferencesPane):
model_factory = SampleEntryPreferences
category = 'Entry'
def traits_view(self):
v = View(Item('auto_add_project_repository',
label='Auto Add Project Repo.',
tooltip='Automatically add a repository with the same name as the project'))
return v
class IrradiationEntryPreferences(BasePreferencesHelper):
preferences_path = 'pychron.entry'
irradiation_prefix = Str
monitor_name = Str
monitor_material = Str
j_multiplier = Float
class FusionsCO2Preferences(FusionsLaserPreferences):
name = FUSIONS_CO2
preferences_path = 'pychron.fusions.co2'
class FusionsUVPreferences(FusionsLaserPreferences):
name = 'Fusions UV'
preferences_path = 'pychron.fusions.uv'
# ===============================================================================
# Panes
# ===============================================================================
class FusionsLaserPreferencesPane(PreferencesPane):
def traits_view(self):
grps = self.get_additional_groups()
v = View(Group(*grps, layout='tabbed'))
return v
def get_additional_groups(self):
archivergrp = Group(Item('use_video_archiver'),
Item('video_archive_days',
label='Archive after N. days',
enabled_when='use_video_archiver'),
Item('video_archive_hours',
label='Archive after N. hours',
enabled_when='use_video_archiver'),
Item('video_archive_months',
label='Delete after N. months',
enabled_when='use_video_archiver'),
Item('reference_detector_name', label='Reference Detector',
editor=EnumEditor(name='_reference_detector_names'),
enabled_when='not use_reference_detector_by_isotope'),
label='Detector',
show_border=True)
iso_grp = VGroup(Item('reference_isotope_name', label='Reference Isotope',
editor=EnumEditor(name='_reference_isotope_names')),
show_border=True,
label='Isotope')
v = View(HGroup(iso_grp, dgrp))
return v
class MassSpecConnectionPane(PreferencesPane):
model_factory = MassSpecConnectionPreferences
category = 'MassSpec'
def traits_view(self):
cgrp = HGroup(Spring(width=10, springy=False),
icon_button_editor('test_connection_button', 'database_connect',
tooltip='Test connection'),
Spring(width=10, springy=False),
Label('Status:'),
CustomLabel('_connected_label',
label='Status',
weight='bold',
color_name='_connected_color'))
massspec_grp = VGroup(Item('enabled', label='Use MassSpec'),
VGroup(Item('name', label='Database', editor=EnumEditor(name='_names')),
password=self.password,
name=self.name,
kind='mysql')
class MassSpecConfigPreferences(BasePreferencesHelper):
preferences_path = 'pychron.massspec.config'
reference_detector_name = Str
reference_isotope_name = Str
use_reference_detector_by_isotope = Bool
_reference_isotope_names = List(('Ar40', 'Ar39', 'Ar38', 'Ar37', 'Ar36'))
_reference_detector_names = List(('H2', 'H1', 'AX', 'L1', 'L2', 'CDD'))
class MassSpecConfigPane(PreferencesPane):
model_factory = MassSpecConfigPreferences
category = 'MassSpec'
def traits_view(self):
dgrp = VGroup(Item('use_reference_detector_by_isotope', label='Set By Isotope'),
Item('reference_detector_name', label='Reference Detector',
editor=EnumEditor(name='_reference_detector_names'),
enabled_when='not use_reference_detector_by_isotope'),
label='Detector',
show_border=True)
iso_grp = VGroup(Item('reference_isotope_name', label='Reference Isotope',
editor=EnumEditor(name='_reference_isotope_names')),
show_border=True,
label='Isotope')
category = 'Google Calendar'
model_factory = GoogleCalendarPreferences
def traits_view(self):
v = View(VGroup(Item('client_secret_path'),
Item('calendar', editor=EnumEditor(name='_calendar_names')),))
return v
class GoogleCalendarExperimentPreferences(BasePreferencesHelper):
preferences_path = 'pychron.google_calendar.experiment'
enabled = Bool
run_delay = Int
class GoogleCalendarExperimentPreferencesPane(PreferencesPane):
category = 'Experiment'
model_factory = GoogleCalendarExperimentPreferences
def traits_view(self):
v = View(VGroup(Item('enabled', label='Enabled', tooltip='Post experiment events to Google Calendar'),
Item('run_delay',
tooltip='Only post an event after at least "Run Delay" runs have been completed',
label='Run Delay')))
return v
from traits.api import Directory
from traitsui.api import View, Item
from envisage.ui.tasks.preferences_pane import PreferencesPane
# ============= standard library imports ========================
# ============= local library imports ==========================
from pychron.envisage.tasks.base_preferences_helper import BasePreferencesHelper
class LoadingPreferences(BasePreferencesHelper):
name = 'Loading'
preferences_path = 'pychron.loading'
id = 'pychron.loading.preferences_page'
save_directory = Directory
class LoadingPreferencesPane(PreferencesPane):
model_factory = LoadingPreferences
category = 'Loading'
def traits_view(self):
v = View(Item('save_directory', label='Output Directory'))
return v
class UserCodeStr(BaseStr):
def validate(self, obj, name, value):
if len(value) < 3:
self.error(obj, name, value)
else:
return value
class IGSNPreferences(BasePreferencesHelper):
preferences_path = 'pychron.igsn'
username = Str
password = Password
user_code = UserCodeStr
class IGSNPreferencesPane(PreferencesPane):
model_factory = IGSNPreferences
category = 'IGSN'
def traits_view(self):
auth_grp = VGroup(Item('username'),
Item('password'),
show_border=True,
label='Authentication')
v = View(VGroup(Item('user_code', tooltip='Three+ alphanumeric characters used as a sample prefix'),
auth_grp))
return v
recent_grp = Group(
Item('recent_hours', label='Hours',
tooltip='Number of hours a "Recent" database search will include'),
label='Recent', )
graphical_filter_grp = Group(Item('graphical_filtering_max_days', label='Max. Days'),
label='Graphical Filter')
v = View(recent_grp, graphical_filter_grp)
return v
class EasyPreferences(BasePreferencesHelper):
use_easy = Bool
preferences_path = 'pychron.processing'
class EasyPreferencesPane(PreferencesPane):
model_factory = EasyPreferences
category = 'Processing'
def traits_view(self):
easy_grp = Group(Item('use_easy'), label='Easy', show_border=True)
v = View(easy_grp)
return v
from traitsui.api import View, Item, VGroup
# ============= standard library imports ========================
# ============= local library imports ==========================
from pychron.envisage.tasks.base_preferences_helper import BasePreferencesHelper
from pychron.mdd import GEOMETRIES
class MDDPreferences(BasePreferencesHelper):
preferences_path = 'pychron.mdd'
executable_root = Directory
default_temp_offset = Float
default_geometry = Enum(*GEOMETRIES)
class MDDPreferencesPane(PreferencesPane):
model_factory = MDDPreferences
category = 'Pipeline'
def traits_view(self):
v = View(VGroup(Item('executable_root', label='Executables Dir.'),
Item('default_temp_offset', label='Default Temp. Offset'),
Item('default_geometry', label='Default Geometry'),
show_border=True, label='MDD'))
return v
# limitations under the License.
# ===============================================================================
# ============= enthought library imports =======================
from envisage.ui.tasks.preferences_pane import PreferencesPane
from traitsui.api import View
# ============= standard library imports ========================
# ============= local library imports ==========================
from pychron.envisage.tasks.base_preferences_helper import GitRepoPreferencesHelper, remote_status_item
class LabBookPreferences(GitRepoPreferencesHelper):
preferences_path = 'pychron.labbook'
class LabBookPreferencesPane(PreferencesPane):
model_factory = LabBookPreferences
category = 'General'
def traits_view(self):
v = View(remote_status_item('LabBook Repo'))
return v