def _get_ratio_group(self): presets = HGroup(Item('atm_constant_name', editor=EnumEditor(name='atm_constant_names')), UItem('add_atm_constant', tooltip='add atm constant entry', style='custom', editor=ButtonEditor(image=icon('add'))), UItem('delete_atm_constant', tooltip='delete current constant entry', enabled_when='atm_constant_entry_deletable', style='custom', editor=ButtonEditor(image=icon('delete')))) ratios = VGroup( presets, HGroup(Spring(springy=False, width=125), Label('Value'), Spring(springy=False, width=55), Label(PLUSMINUS_ONE_SIGMA), Spring(springy=False, width=55), Label('Citation')), HGroup(Item('Ar40_Ar36_atm', label='(40Ar/36Ar)atm'), Item('Ar40_Ar36_atm_error', show_label=False), Item('Ar40_Ar36_atm_citation', show_label=False)), HGroup(Item('Ar40_Ar38_atm', label='(40Ar/38Ar)atm'), Item('Ar40_Ar38_atm_error', show_label=False), Item('Ar40_Ar38_atm_citation', show_label=False)), Item('_'), HGroup( Item('Ar37_Ar39_mode', label='(37Ar/39Ar)K'), Item('Ar37_Ar39', show_label=False), Item('Ar37_Ar39_error', show_label=False)), label='Ratios') return ratios
def _get_decay_group(self): presets = HGroup( Item('decay_constant_name', editor=EnumEditor(name='decay_constant_names')), UItem('add_decay_constant', tooltip='add decay constant entry', style='custom', editor=ButtonEditor(image=icon('add'))), UItem('delete_decay_constant', tooltip='delete current constant entry', enabled_when='decay_constant_entry_deletable', style='custom', editor=ButtonEditor(image=icon('delete')))) vs = [('Ar40K epsilon/yr', 'lambda_e', 'lambda_e_error'), ('Ar40K beta/yr', 'lambda_b', 'lambda_b_error'), ('Cl36/d', 'lambda_Cl36', 'lambda_Cl36_error'), ('Ar37/d', 'lambda_Ar37', 'lambda_Ar37_error'), ('Ar39/d', 'lambda_Ar39', 'lambda_Ar39_error')] items = [ HGroup(Label(l), spring, UItem(v), UItem(e)) for l, v, e in vs ] decay = VGroup(presets, HGroup( Item('total_k_decay', style='readonly', label='Total Ar40K/yr')), HGroup(spring, Label('Value'), Spring(width=75, springy=False), Label(PLUSMINUS_ONE_SIGMA), Spring(width=75, springy=False)), *items, show_border=True, label='Decay') return decay
def _get_ratio_group(self): presets = HGroup(Item('atm_constant_name', editor=EnumEditor(name='atm_constant_names')), UItem('add_atm_constant', tooltip='add atm constant entry', style='custom', editor=ButtonEditor(image=icon('add'))), UItem('delete_atm_constant', tooltip='delete current constant entry', enabled_when='atm_constant_entry_deletable', style='custom', editor=ButtonEditor(image=icon('delete')))) ratios = VGroup( presets, HGroup(Spring(springy=False, width=125), Label('Value'), Spring(springy=False, width=55), Label(PLUSMINUS_ONE_SIGMA), Spring(springy=False, width=55), Label('Citation')), HGroup(Item('ar40_ar36_atm', label='(40Ar/36Ar)atm'), Item('ar40_ar36_atm_error', show_label=False), Item('ar40_ar36_atm_citation', show_label=False), enabled_when='atm_constant_entry_deletable'), HGroup(Item('ar40_ar38_atm', label='(40Ar/38Ar)atm'), Item('ar40_ar38_atm_error', show_label=False), Item('ar40_ar38_atm_citation', show_label=False), enabled_when='atm_constant_entry_deletable'), Item('_'), HGroup( Item('ar37_ar39_mode', label='(37Ar/39Ar)K'), Item('ar37_ar39', show_label=False, enabled_when='ar37_ar39_mode=="Fixed"'), Item('ar37_ar39_error', show_label=False, enabled_when='ar37_ar39_mode=="Fixed"')), label='Ratios') return ratios
def _get_decay_group(self): presets = HGroup(Item('decay_constant_name', editor=EnumEditor(name='decay_constant_names')), UItem('add_decay_constant', tooltip='add decay constant entry', style='custom', editor=ButtonEditor(image=icon('add'))), UItem('delete_decay_constant', tooltip='delete current constant entry', enabled_when='decay_constant_entry_deletable', style='custom', editor=ButtonEditor(image=icon('delete')))) vs = [ ('Ar40K epsilon/yr', 'lambda_e', 'lambda_e_error'), ('Ar40K beta/yr', 'lambda_b', 'lambda_b_error'), ('Cl36/d', 'lambda_cl36', 'lambda_cl36_error'), ('Ar37/d', 'lambda_ar37', 'lambda_ar37_error'), ('Ar39/d', 'lambda_ar39', 'lambda_ar39_error')] items = [HGroup(Label(l), spring, UItem(v), UItem(e)) for l, v, e in vs] items.append(Item('use_irradiation_endtime', label='Use Irradiation End time', tooltip='Use irradiation end time for decay calculations instead of the start time. ' 'FYI Mass Spec and NMGRL by default use the start time. ' 'McDougall and Harrison 1999 and ArArCalc use the end time.')) decay = VGroup( presets, HGroup(Item('total_k_decay', style='readonly', label='Total Ar40K/yr')), HGroup(spring, Label('Value'), Spring(width=75, springy=False), Label(PLUSMINUS_ONE_SIGMA), Spring(width=75, springy=False)), *items, show_border=True, label='Decay') return decay
def _get_decay_group(self): presets = HGroup(Item('decay_constant_name', editor=EnumEditor(name='decay_constant_names')), UItem('add_decay_constant', tooltip='add decay constant entry', style='custom', editor=ButtonEditor(image=icon('add'))), UItem('delete_decay_constant', tooltip='delete current constant entry', enabled_when='decay_constant_entry_deletable', style='custom', editor=ButtonEditor(image=icon('delete')))) vs = [ ('Ar40K epsilon/yr', 'lambda_e', 'lambda_e_error'), ('Ar40K beta/yr', 'lambda_b', 'lambda_b_error'), ('Cl36/d', 'lambda_Cl36', 'lambda_Cl36_error'), ('Ar37/d', 'lambda_Ar37', 'lambda_Ar37_error'), ('Ar39/d', 'lambda_Ar39', 'lambda_Ar39_error')] items = [HGroup(Label(l), spring, UItem(v), UItem(e)) for l, v, e in vs] decay = VGroup( presets, HGroup(Item('total_k_decay', style='readonly', label='Total Ar40K/yr')), HGroup(spring, Label('Value'), Spring(width=75, springy=False), Label(PLUSMINUS_ONE_SIGMA), Spring(width=75, springy=False)), *items, show_border=True, label='Decay') return decay
def traits_view(self): cols = [ ObjectColumn(name='name', label='', editable=False), ObjectColumn(name='counts'), ObjectColumn(name='settle', label='Settle (s)'), ObjectColumn(name='isotopes_label', editable=False, width=175, label='Isotopes') ] hgrp = VGroup( UItem('object.hop_sequence.hops', editor=myTableEditor(columns=cols, clear_selection_on_dclicked=True, sortable=False, selected='selected')), HGroup( icon_button_editor('add_hop_button', 'add', tooltip='Add peak hop'), icon_button_editor('remove_hop_button', 'delete', tooltip='Delete selected peak hop', enabled_when='selected'))) sgrp = UItem('selected', style='custom', editor=InstanceEditor()) grp = HSplit(hgrp, sgrp) save_action = Action(name='Save', image=icon('document-save'), enabled_when='object.saveable', action='save') save_as_acion = Action( name='Save As', image=icon('document-save-as'), action='save_as', enabled_when='object.saveasable', ) teditor = myTextEditor(bgcolor='#F7F6D0', fontsize=12, fontsize_name='fontsize', wrap=False, tab_width=15) v = View( VGroup( VGroup(grp, label='Editor'), VGroup(UItem('object.text', editor=teditor, style='custom'), label='Text')), # toolbar=ToolBar(), width=690, title=self.title, buttons=['OK', save_action, save_as_acion], resizable=True) return v
def traits_view(self): cols = [ObjectColumn(name='name', label='', editable=False), ObjectColumn(name='counts'), ObjectColumn(name='settle', label='Settle (s)'), ObjectColumn(name='isotopes_label', editable=False, width=175, label='Isotopes')] hgrp = VGroup( UItem('object.hop_sequence.hops', editor=myTableEditor(columns=cols, clear_selection_on_dclicked=True, sortable=False, selected='selected')), HGroup(icon_button_editor('add_hop_button', 'add', tooltip='Add peak hop'), icon_button_editor('remove_hop_button', 'delete', tooltip='Delete selected peak hop', enabled_when='selected'))) sgrp = UItem('selected', style='custom', editor=InstanceEditor()) grp = HSplit(hgrp, sgrp) save_action = Action(name='Save', image=icon('document-save'), enabled_when='object.saveable', action='save') save_as_acion = Action(name='Save As', image=icon('document-save-as'), action='save_as', enabled_when='object.saveasable', ) teditor = myTextEditor(bgcolor='#F7F6D0', fontsize=12, fontsize_name='fontsize', wrap=False, tab_width=15) v = View(Tabbed(VGroup(grp, label='Editor'), VGroup(UItem('object.text', editor=teditor, style='custom'), label='Text')), # toolbar=ToolBar(), width=690, title=self.title, buttons=['OK', save_action, save_as_acion], resizable=True) return v
class OpenHopsEditorAction(HopsEditorAction): description = 'Open existing peak hop editor' name = 'Open Peak Hops' image = icon('document-open') def _perform(self, m): m.open()
class RefreshActiveEditorAction(TaskAction): name = 'Refresh Plot' dname = 'Refresh Plot' method = 'refresh_active_editor' image = icon('refresh') # accelerator = 'Ctrl+Shift+R' id = 'pychron.refresh_plot'
class ImportIrradiationFileAction(TaskAction): name = 'Import Irradiation File' image = icon('file_xls') method = 'import_irradiation_load_xls' description = 'Import irradiation information from an Excel file. Use "Irradiation Template" ' \ 'to generate a boilerplate irradiation template'
class MakeIrradiationTemplateAction(TaskAction): name = 'Irradiation Template' dname = 'Irradiation Template' image = icon('file_xls') method = 'make_irradiation_load_template' ddescription = 'Make an Excel irradiation template that can be used to import irradiation information.'
def __init__(self, editor, layout=None, *args, **kw): super(_FilterTableView, self).__init__(editor, *args, **kw) # vlayout = QVBoxLayout() # layout.setSpacing(2) # self.table = table = _myFilterTableView(parent) # self.table = table = _TableView(parent) # table.setSizePolicy(QSizePolicy.Fixed, # QSizePolicy.Fixed) # table.setMinimumHeight(100) # table.setMaximumHeight(50) # table.setFixedHeight(50) # table.setFixedWidth(50) hl = QHBoxLayout() self.button = button = QPushButton() button.setIcon(icon("delete").create_icon()) button.setEnabled(False) button.setFlat(True) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(15) button.setFixedHeight(15) self.text = text = QLineEdit() hl.addWidget(text) hl.addWidget(button) # vlayout.addLayout(hl) layout.addLayout(hl)
def __init__(self, editor, layout=None, *args, **kw): super(_FilterTableView, self).__init__(editor, *args, **kw) # layout = QVBoxLayout() # layout.setSpacing(1) # self.table = table = _TableView(parent) hl = QHBoxLayout() # hl.setSpacing(10) # self.button = button = QPushButton() button.setIcon(icon('delete').create_icon()) button.setEnabled(False) button.setFlat(True) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(15) button.setFixedHeight(15) self.text = text = QLineEdit() self.cb = cb = QCheckBox() # text.setEnabled(False) button.setEnabled(False) # table.setEnabled(False) # cb.setSizePolicy(QSizePolicy.Fixed, # QSizePolicy.Fixed) # cb.setFixedWidth(20) # cb.setFixedHeight(20) # hl.addWidget(cb) hl.addWidget(text) hl.addWidget(button) layout.addLayout(hl)
class PushVCSAction(VCSAction): image = icon('arrow_up.png') name='Push' def perform(self, event): app=event.task.window.application task=app.open_task('pychron.processing.vcs') task.initiate_push()
class SaveAsCurrentExperimentAction(TaskAction): description = 'Save As Current Experiment' name = 'Save As Current Experiment...' dname = 'Save As Current Experiment' image = icon('document-save-as') id = 'pychron.experiment.save_as_current_experiment' method = 'save_as_current_experiment'
def __init__(self, parent, *args, **kw): super(_FilterTableView, self).__init__(*args, **kw) layout = QVBoxLayout() layout.setSpacing(2) self.table = table = _myFilterTableView(parent) table.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) # table.setMinimumHeight(100) # table.setMaximumHeight(50) table.setFixedHeight(50) # table.setFixedWidth(50) hl = QHBoxLayout() self.button = button = QPushButton() button.setIcon(icon('delete').create_icon()) button.setEnabled(False) button.setFlat(True) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(25) self.text = text = QLineEdit() hl.addWidget(text) hl.addWidget(button) layout.addLayout(hl) layout.addWidget(table) self.setLayout(layout)
def __init__(self, editor, layout=None, *args, **kw): super(_FilterTableView, self).__init__(editor, *args, **kw) # layout = QVBoxLayout() # layout.setSpacing(1) # self.table = table = _TableView(parent) hl = QHBoxLayout() # hl.setSpacing(10) # self.button = button = QPushButton() button.setIcon(icon('delete').create_icon()) button.setEnabled(False) button.setFlat(True) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(15) button.setFixedHeight(15) self.text = text = QLineEdit() self.cb = cb = QCheckBox() # text.setEnabled(False) button.setEnabled(False) # table.setEnabled(False) # cb.setSizePolicy(QSizePolicy.Fixed, # QSizePolicy.Fixed) # cb.setFixedWidth(20) # cb.setFixedHeight(20) # hl.addWidget(cb) hl.addWidget(text) hl.addWidget(button) layout.addLayout(hl)
class GenerateTrayAction(TaskAction): name = 'Generate Tray' dname = 'Generate Tray' image = icon('table_lightning') method = 'generate_tray' ddescription = 'Make a irradiation tray image from an irradiation tray text file.'
class AppendIdeogramAction(TaskAction): name = 'Append Ideogram' method = 'append_ideogram' tooltip = '''Add selected analyses to current ideogram. If no analyses selected add all from the selected sample''' image = icon('ideo_add.png')
class MakeIrradiationTemplateAction(Action): name = 'Irradiation Template' dname = 'Irradiation Template' image = icon('file_xls') ddescription = 'Make an Excel irradiation template that can be used to import irradiation information.' 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)
class AppendSpectrumAction(TaskAction): name = 'Append Spectrum' method = 'append_spectrum' tooltip = '''Add selected analyses to current spectrum. If no analyses selected add all from the selected sample''' image = icon('chart_curve_add.png')
class TagAction(TaskAction): name = 'Tag...' dname = 'Tag' # accelerator = 'Ctrl+Shift+t' method = 'set_tag' image = icon('tag-blue-add') id = 'pychron.tag'
class BuildApplicationAction(UIAction): name = 'Build' image = icon('bricks') def perform(self, event): app = event.task.window.application up = app.get_service('pychron.updater.updater.Updater') up.build()
class GenerateIdentifiersAction(TaskAction): name = 'Generate Identifiers' image = icon('table_lightning') method = 'generate_identifiers' description = 'Automatically generate labnumbers (aka identifiers) for each irradiation position in the ' \ 'currently selected irradiation.'
class PullVCSAction(Action): name='Pull' image = icon('arrow_down.png') def perform(self, event): app = event.task.window.application task = app.open_task('pychron.processing.vcs') task.initiate_pull()
class OpenExperimentQueueAction(ExperimentAction): description = 'Open experiment' name = 'Open Experiment...' image = icon('project-open') id = 'pychron.open_experiment' def perform(self, event): open_experiment(event)
class ManageBranchAction(UIAction): name = 'Manage Branch' image = icon('update-product') accelerator = 'Ctrl+.' def perform(self, event): app = event.task.window.application up = app.get_service('pychron.updater.updater.Updater') up.manage_branches()
class GenericSaveAsAction(PTaskAction): name = 'Save As...' accelerator = 'Ctrl+Shift+S' image = icon('document-save-as') def perform(self, event): task = self.task if hasattr(task, 'save_as'): task.save_as()
class EditInitializationAction(Action): name = 'Edit Initialization' image = icon('brick-edit') def perform(self, event): from pychron.envisage.initialization.initialization_edit_view import edit_initialization if edit_initialization(): restart()
class ManageVersionAction(Action): name = 'Manage Version' dname = 'Manage Version' image = icon('update-product') accelerator = 'Ctrl+;' def perform(self, event): app = event.task.window.application up = app.get_service('pychron.updater.updater.Updater') up.manage_version()
class OpenCurrentExperimentQueueAction(ExperimentAction): description = 'Open Current Experiment' name = 'Open Current Experiment...' dname = 'Open Current Experiment' image = icon('project-open') id = 'pychron.open_current_experiment' def perform(self, event): path = os.path.join(paths.experiment_dir, 'Current Experiment.txt') open_experiment(event, path)
class CheckForUpdatesAction(UIAction): name = 'Check For Updates' image = icon('update-product') description = 'Check for updates to Pychron by examining the public Github.' def perform(self, event): app = event.task.window.application up = app.get_service('pychron.updater.updater.Updater') up.check_for_updates(inform=True)
class DocumentationAction(WebAction): name = 'View Documentation' image = icon('documentation') def perform(self, event): """ goto issues page add an request or report bug """ url = 'http://pychron.readthedocs.org/en/latest/index.html' self._open_url(url)
class PositionAction(PAction): name = 'Window Positions' image = icon('window-new') def perform(self, event): from pychron.envisage.tasks.layout_manager import LayoutManager app = event.task.window.application lm = LayoutManager(app) lm.edit_traits()
class WaffleAction(WebAction): name = 'View Waffle Board' image = icon('waffle') def perform(self, event): """ goto waffle page """ url = 'https://waffle.io/NMGRL/pychron' self._open_url(url)
def icon_button_editor(trait, name, label=None, editor_kw=None, **kw): if editor_kw is None: editor_kw = {} name = '{}.png'.format(name) kw['show_label'] = label is not None kw['label'] = label or '' image = icon(name) return Item(trait, style='custom', editor=ButtonEditor(image=image, **editor_kw), **kw)
class OpenPyScriptAction(FileOpenAction): """ """ id = 'pychron.open_pyscript' description = 'Open pyscript' name = 'Open Script...' # accelerator = 'Ctrl+Shift+O' image = icon('document-open') task_id = 'pychron.pyscript.task' # test_path = '/Users/ross/Pychrondata_dev/scripts/extraction/jan_pause.py' test_path = '/Users/ross/Pychron_dev/scripts/measurement/jan_unknown.py'
def traits_view(self): hue_grp = VGroup(HGroup(spring, UItem('hue_default_button')), Item('hue'), Item('saturation'), Item('brightness'), show_border=True, label='Hue/Saturation/Brightness') c_gamma_grp = VGroup(HGroup(spring, UItem('contrast_default_button')), Item('contrast'), Item('gamma'), show_border=True, label='Contrast/Gamma') exposure_grp = VGroup(Item('auto_exposure_enabled'), Item('exposure_time', enabled_when='not auto_exposure_enabled'), show_border=True, label='Exposure') white_balance_grp = VGroup(UItem('awb_button'), show_border=True, label='White Balance') # color_grp = VGroup(label='Color') meta_grp = VGroup(HGroup(Item('use_auto_snapshot_name', label='Use Auto'), Item('snapshot_name', label='Name', enabled_when='not use_auto_snapshot_name'), Item('extension')), VGroup(UItem('note', style='custom'), show_border=True, label='Note'), show_border=True, label='Meta') ctrlgrp = VFold(meta_grp, hue_grp, exposure_grp, c_gamma_grp, white_balance_grp) v = View(HSplit(ctrlgrp, UItem('_device', width=640, height=480, editor=CameraEditor())), toolbar=ToolBar(Action(action='do_snapshot', image=icon('camera'), name='Snapshot' ), # Action(action='save_settings', # image=icon('cog')) ), title='Camera', resizable=True) # v = View(VGroup(meta_grp, exposure_grp, c_gamma_grp, # white_balance_grp)) return v
def get_icon(self, obj, is_expanded): name = self.icon_name if not isinstance(obj, Pipeline): if not obj.enabled: name = 'cancel' if name in ICON_MAP: i = ICON_MAP[name] else: i = icon(name) ICON_MAP[name] = i return i
def _view_groups(self): def groupfunc(task_factory): gid = 0 if hasattr(task_factory, 'task_group'): gid = task_factory.task_group if gid: gid = ('hardware', 'experiment').index(gid) + 1 else: gid = 0 return gid application = self.window.application groups = [] for _, factories in groupby(sorted(application.task_factories, key=groupfunc), key=groupfunc): items = [] for factory in factories: for win in application.windows: if win.active_task: if win.active_task.id == factory.id: checked = True break else: checked = False action = myTaskWindowLaunchAction(task_id=factory.id, checked=checked) if hasattr(factory, 'accelerator'): action.accelerator = factory.accelerator add = True if hasattr(factory, 'include_view_menu'): add = factory.include_view_menu if hasattr(factory, 'image'): if factory.image: action.image = icon(factory.image) if add: items.append(ActionItem(action=action)) groups.append(TaskGroup(items=items)) groups.append(DockPaneToggleGroup()) return groups
def __init__(self, *args, **kw): super(ComboBoxWidget, self).__init__(*args, **kw) layout = QHBoxLayout() layout.setSpacing(2) self.combo = combo = QComboBox() combo.setSizeAdjustPolicy(QComboBox.AdjustToContents) combo.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.button = button = QPushButton() button.setEnabled(False) button.setIcon(icon('add').create_icon()) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(20) button.setFixedHeight(20) layout.addWidget(combo) layout.addSpacing(10) layout.addWidget(button) self.setLayout(layout)
def get_icon(self, object, is_expanded): return icon('cog')
('Irrad. Pos.', 'irradiation_pos'), ('Packet', 'packet')] odd_bg_color = 'lightgray' name_width = Int(125) labnumber_width = Int(60) material_width = Int(75) def get_menu(self, obj, trait, row, column): if obj.selected_samples: return MenuManager(Action(name='Unselect', action='unselect_samples'), Action(name='Chronological View', action='load_chrono_view'), Action(name='Configure', action='configure_sample_table')) REVIEW_STATUS_ICONS = {'Default': icon('gray_ball'), 'Intermediate': icon('orange_ball'), 'All': icon('green_ball')} class AnalysisAdapter(BrowserAdapter): all_columns = [('Review', 'review_status'), ('Run ID', 'record_id'), ('UUID', 'uuid'), ('Sample', 'sample'), ('Project', 'project'), ('Packet', 'packet'), ('Irradiation', 'irradiation_info'), ('Tag', 'tag'), ('RunDate', 'rundate'), ('Dt', 'delta_time'),
def get_icon(self, obj, is_expanded): return icon('package-green')
def get_icon(self, obj, is_expanded): if obj.enabled: return icon('tick') else: return icon('cancel')
def get_icon(self, object, is_expanded): name = self.icon_name if not object.enabled: name = 'cancel' return icon(name)
def get_icon(self, obj, is_expanded): return icon('tick' if obj.enabled else 'cancel')
# ============= enthought library imports ======================= from __future__ import absolute_import from envisage.ui.tasks.preferences_category import PreferencesCategory from envisage.ui.tasks.preferences_dialog import PreferencesDialog as PD, PreferencesTab from pyface.tasks.topological_sort import before_after_sort from traits.api import on_trait_change, Property from traitsui.api import View, UItem from traitsui.group import HGroup # ============= standard library imports ======================== # ============= local library imports ========================== from traitsui.tabular_adapter import TabularAdapter from pychron.core.ui.tabular_editor import myTabularEditor from pychron.envisage.resources import icon ICON_MAP = {'Database': icon('database'), 'Social': icon('edit-group'), 'Experiment': icon('applications-science_32'), 'Console': icon('openterm'), 'Processing': icon('tools-anvil'), 'Update': icon('update_misc'), 'General': icon('home'), 'Spectrometer': icon('spectrum_emission'), 'Browser': icon('application_form_magnify'), # 'Hardware': icon('speedometer'), 'MassSpec': icon('mass_spec'), 'DVC': icon('git_orange'), 'GitHub': icon('github'), 'GitLab': icon('gitlab'), 'Pipeline': icon('pipe'), 'Hardware': icon('toolbox'),
def _create_control(self, parent): widget = AnimatedWidget(icon(self.value)) return widget
from pychron.pychron_constants import EXTRACTION_COLOR, MEASUREMENT_COLOR, SUCCESS_COLOR, \ SKIP_COLOR, NOT_EXECUTABLE_COLOR, CANCELED_COLOR, TRUNCATED_COLOR, \ FAILED_COLOR, END_AFTER_COLOR # ============= local library imports ========================== COLORS = {'success': SUCCESS_COLOR, 'extraction': EXTRACTION_COLOR, 'measurement': MEASUREMENT_COLOR, 'canceled': CANCELED_COLOR, 'truncated': TRUNCATED_COLOR, 'failed': FAILED_COLOR, 'end_after': END_AFTER_COLOR, 'invalid': 'red', 'aborted': 'orange'} GRAY_BALL = icon('gray_ball') GREEN_BALL = icon('green_ball') ORANGE_BALL = icon('orange_ball') class ExecutedAutomatedRunSpecAdapter(TabularAdapter, ConfigurableMixin): all_columns = [ ('-', 'result'), ('Labnumber', 'labnumber'), ('Aliquot', 'aliquot'), ('Sample', 'sample'), ('RepositoryID', 'repository_identifier'), ('Position', 'position'), ('Extract', 'extract_value'), ('Units', 'extract_units'), ('Ramp (s)', 'ramp_duration'),
# =============================================================================== # ============= enthought library imports ======================= from envisage.ui.tasks.preferences_category import PreferencesCategory from envisage.ui.tasks.preferences_dialog import PreferencesDialog as PD, PreferencesTab from pyface.tasks.topological_sort import before_after_sort from traitsui.api import View, UItem from traitsui.group import HGroup from traits.api import on_trait_change, Property # ============= standard library imports ======================== # ============= local library imports ========================== from traitsui.tabular_adapter import TabularAdapter from pychron.core.ui.tabular_editor import myTabularEditor from pychron.envisage.resources import icon ICON_MAP = {'Database': icon('database'), 'Social': icon('edit-group'), 'Experiment': icon('applications-science_32'), 'Console': icon('openterm'), 'Processing': icon('tools-anvil'), 'Update': icon('update_misc'), 'General': icon('go-home-5'), 'Spectrometer': icon('spectrum_emission'), # 'Hardware': icon('speedometer'), 'Hardware': icon('toolbox'), 'Constants': icon('applications-education-mathematics'), 'Labspy': icon('labspy'), 'Fusions Diode': icon('laser'), 'Fusions UV': icon('laser'), 'Fusions CO2': icon('laser'), 'ExtractionLine': icon('motherboard'),
from __future__ import absolute_import from pyface.action.menu_manager import MenuManager from pyface.tasks.traits_dock_pane import TraitsDockPane from pyface.tasks.traits_task_pane import TraitsTaskPane from traits.api import Int, Property from traitsui.api import View, UItem, Item, HGroup, VGroup, TabularEditor, EnumEditor, spring, Tabbed, Handler from traitsui.menu import Action from traitsui.tabular_adapter import TabularAdapter from pychron.core.ui.combobox_editor import ComboboxEditor from pychron.envisage.icon_button_editor import icon_button_editor from pychron.envisage.resources import icon from pychron.pychron_constants import INITIAL_STEPS, IMAGE_STEPS, HIGH_GRADE_STEPS IMAGE_ICON = icon('image') class SamplesAdapter(TabularAdapter): columns = [('Name', 'name'), ('Material', 'material'), ('Grainsize', 'grainsize')] font = 'arial 10' odd_bg_color = '#d6f5f5' def get_menu(self, obj, trait, row, column): # item = getattr(obj, trait)[row] actions = [Action(name='Move', action='move_to_session')] menu = MenuManager(*actions) return menu
# limitations under the License. # =============================================================================== import csv import os from traits.api import Instance, List, HasTraits, Str, Event, Any, Bool, Color from traitsui.api import View, UItem, VGroup # from traitsui.editors import TreeEditor from traitsui.tree_node import TreeNode from pychron.core.ui.tree_editor import TreeEditor from pychron.envisage.resources import icon from pychron.envisage.tasks.base_editor import BaseTraitsEditor from pychron.graph.diffusion_graph import DiffusionGraph visible = icon('eye') class MDDItemNode(TreeNode): def get_icon(self, obj, is_expanded): icon = visible if obj.visible else '' return icon class BaseItem(HasTraits): name = Str enabled = Bool(True) class MDDItem(BaseItem): plots = List
import os import yaml # ============= local library imports ========================== from pychron.core.helpers.ctx_managers import no_update from pychron.core.helpers.filetools import get_path from pychron.paths import paths from pychron.core.helpers.formatting import floatfmt from pychron.envisage.icon_button_editor import icon_button_editor from pychron.envisage.resources import icon from pychron.experiment.conditional.conditional import conditional_from_dict, ActionConditional, TruncationConditional, \ CancelationConditional, TerminationConditional, BaseConditional from pychron.experiment.conditional.regexes import CP_REGEX, STD_REGEX, ACTIVE_REGEX, BASELINECOR_REGEX, BASELINE_REGEX, \ MAX_REGEX, MIN_REGEX, AVG_REGEX, COMP_REGEX, ARGS_REGEX, BETWEEN_REGEX, SLOPE_REGEX from pychron.experiment.utilities.conditionals import level_text, level_color GREENBALL = icon('green_ball') class BaseConditionalsAdapter(TabularAdapter): level_text = Property tripped_text = Str('') tripped_image = Property # value_text = Property def get_bg_color(self, obj, trait, row, column=0): item = getattr(obj, trait)[row] return level_color(item.level) # def _get_value_text(self): # return floatfmt(self.item.value)
def _get_result_image_image(self): return icon(ICON_MAP[self.item.result])
def get_icon(self, obj, is_expanded): return icon("tick" if obj.enabled else "cancel")