def update_show_hide_peak_btn(self): if self.selected_peak: print(self.selected_peak.hidden) self.hide_peak_button.Enable() if self.selected_peak.hidden: self.hide_peak_button.SetLabelText("Show Peak") # self.hide_peak_button.SetBitmapLabel(get_icon(wx.ART_TICK_MARK, 24)) self.hide_peak_button.SetBitmapLabel( get_icon("show-open-eye", 24)) else: self.hide_peak_button.SetLabelText("Hide Peak") # self.hide_peak_button.SetBitmapLabel(get_icon(wx.ART_CROSS_MARK, 24)) self.hide_peak_button.SetBitmapLabel( get_icon("hide-closed-eye", 24)) else: self.hide_peak_button.Disable() # self.hide_peak_button.SetLabelText("Hide Peak") # # self.hide_peak_button.SetBitmapLabel(get_icon(wx.ART_CROSS_MARK, 24)) # self.hide_peak_button.SetBitmapLabel(get_icon("hide-closed-eye", 24)) self.hide_peak_button.SetLabelText("Show Peak") # self.hide_peak_button.SetBitmapLabel(get_icon(wx.ART_TICK_MARK, 24)) self.hide_peak_button.SetBitmapLabel(get_icon("show-open-eye", 24)) self.hide_peak_button.Refresh()
def _populate_toolbar(self): self.add_tool( ToolData( name="New Experiment (Ctrl+E)", icon=get_icon("new-experiment", 24), id=ID_New_Experiment, handler=self.parent.on_new_experiment, ), wx.ITEM_DROPDOWN) new_experiment_menu = wx.Menu() new_experiment_menu.Append(ID_New_Experiment_Single, "Create New Experiment", "") new_experiment_menu.Append(ID_New_Experiment_Multiple, "Create Multiple Experiments", "") self.SetDropdownMenu(ID_New_Experiment, new_experiment_menu) self.add_tool( ToolData(name="Previous Experiment (Ctrl+<)", icon=get_icon(wx.ART_GO_BACK, tb_icon_size[0]), id=ID_Previous_Experiment)) self.add_tool( ToolData(name="Next Experiment (Ctrl+>)", icon=get_icon(wx.ART_GO_FORWARD, tb_icon_size[0]), id=ID_Next_Experiment))
def _setup_image_list(self): # Image List isz = (16, 16) self.il = wx.ImageList(isz[0], isz[1]) self.il.Add(get_icon("chromatogram", isz[0])) self.il.Add(get_icon("peak", isz[0])) self.il.Add(get_icon("Conical_flask_red", isz[0])) self.tree.SetImageList(self.il)
def _populate_toolbar(self): self.add_tool( ToolData("Configure Colours", get_icon("configure-colours", 24), ID_Config_Colours)) self.add_tool( ToolData("Configure Markers", get_icon("configure-markers", 24), ID_Config_Markers)) self.add_tool( ToolData("Configure Borders", get_icon("configure-borders", 24), ID_Config_Borders))
def _create_buttons(self): # Create Buttons # TODO: Tooltips and bindings IdentificationPanel._create_buttons(self) self.peak_number_combo = wx.ComboBox(self, size=(100, -1), validator=CharValidator("int-only")) self.previous_peak_btn = buttons.GenBitmapButton(self, bitmap=get_icon(wx.ART_GO_BACK, 24)) self.previous_peak_btn.SetToolTip("Previous Peak") self.next_peak_btn = buttons.GenBitmapButton(self, bitmap=get_icon(wx.ART_GO_FORWARD, 24)) self.next_peak_btn.SetToolTip("Next Peak") self.btn_sizer.AddSpacer(20) self.btn_sizer.Add(wx.StaticText(self, label="Peak Number: "), 1, wx.ALIGN_CENTER_VERTICAL, 0) self.btn_sizer.Add(self.peak_number_combo, 0, wx.EXPAND, 0) self.btn_sizer.Add(self.previous_peak_btn, 0, wx.EXPAND, 0) self.btn_sizer.Add(self.next_peak_btn, 0, wx.EXPAND, 0)
def __set_properties(self): # begin wxGlade: _WelcomeDialog.__set_properties self.SetTitle("Welcome to GunShotMatch") self.SetSize((777, 460)) self.left_panel.SetMinSize((300, -1)) self.version_label.SetFont(wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "")) self.new_project_button.SetMinSize((200, 40)) self.open_project_button.SetMinSize((200, 40)) self.new_experiment_button.SetMinSize((40, 40)) self.new_experiment_button.SetToolTip("Create a new Experiment") self.method_editor_button.SetMinSize((40, 40)) self.method_editor_button.SetToolTip("Open the Method Editor") self.ammo_editor_editor.SetMinSize((40, 40)) self.ammo_editor_editor.SetToolTip("Open the Ammunition Details Editor") self.show_dialog_checkbox.SetMinSize((-1, 40)) self.show_dialog_checkbox.SetValue(1) self.settings_button.SetMinSize((-1, 40)) self.help_button.SetMinSize((-1, 40)) # end wxGlade _icon = wx.NullIcon _icon.CopyFromBitmap(get_icon("logo-v2", 256)) self.SetIcon(_icon) self.add_recent_projects() if self.recent_project_ctrl.GetItemCount() == 0: self.left_panel.Show(False) self.Layout() if "msw" in wx.Platform.lower(): self.SetSize((793, 487))
def _populate_toolbar(self): self.add_tool( ToolData( name="New Project (Ctrl+N)", icon=get_icon(wx.ART_NEW, tb_icon_size[0]), id=wx.ID_NEW, handler=self.parent.on_new_project, )) self.add_tool( ToolData( name="Open Project (Ctrl+O)", icon=get_icon(wx.ART_FILE_OPEN, tb_icon_size[0]), id=wx.ID_OPEN, handler=self.parent.on_open_project, ), wx.ITEM_DROPDOWN) recent_menu = wx.Menu() for ID in recent_project_ids: recent_menu.Append(ID, "item", "") self.SetDropdownMenu(wx.ID_OPEN, recent_menu) self.add_tool( ToolData( name="Save Project (Ctrl+S)", icon=get_icon(wx.ART_FILE_SAVE, tb_icon_size[0]), id=wx.ID_SAVE, handler=self.parent.on_save_project, )) self.add_tool( ToolData( name="Save All", icon=get_icon("geany-save-all", 24), id=ID_Save_All, handler=self.parent.on_save_all, )) self.add_tool( ToolData( name="Close Project", icon=get_icon("close", tb_icon_size[0]), id=ID_Close_Project, handler=self.parent.on_close_project, ))
def _populate_toolbar(self): self.add_tool( ToolData("Previous Experiment (Ctrl+<)", get_icon(wx.ART_GO_BACK, tb_icon_size[0]), ID_Spec_Viewer_Previous_Experiment, self.parent.previous_experiment)) self.add_tool( ToolData("Next Experiment (Ctrl+>)", get_icon(wx.ART_GO_FORWARD, tb_icon_size[0]), ID_Spec_Viewer_Next_Experiment, self.parent.next_experiment)) self.AddSeparator() self.add_tool( ToolData("Reset View", get_icon(wx.ART_GO_HOME, tb_icon_size[0]), ID_Spec_Viewer_View_Reset, self.parent.reset_view)) self.add_tool( ToolData("Previous View", get_icon(wx.ART_GO_TO_PARENT, tb_icon_size[0]), ID_Spec_Viewer_View_Previous, self.parent.previous_view)) self.add_radio_tool( ToolData("Select", get_icon("default-cursor", 24), ID_Spec_Viewer_View_Default, self.parent.tool_select)) self.add_radio_tool( ToolData("Zoom (Ctrl+Shift+Z)", get_icon("zoom", 24), ID_Spec_Viewer_View_Zoom, self.parent.tool_zoom)) self.add_radio_tool( ToolData("Pan (Ctrl+Shift+P)", get_icon("gimp-tool-move", 24), ID_Spec_Viewer_View_Pan, self.parent.tool_pan)) self.AddSeparator() self.add_tool( ToolData("View Spectrum By Scan No.", get_icon("mass-spectrum-123", tb_icon_size[0]), ID_Spec_Viewer_by_num, self.parent.spectrum_by_number)) self.add_tool( ToolData("View Spectrum By RT", get_icon("mass-spectrum-rt", tb_icon_size[0]), ID_Spec_Viewer_by_rt, self.parent.spectrum_by_rt))
def _create_buttons(self): self.btn_sizer = wx.BoxSizer(wx.HORIZONTAL) self.sort_filter_btn = buttons.GenBitmapTextButton(self, -1, None, "Sort & Filter ") self.sort_filter_btn.SetBitmapLabel(get_icon("data-filter", 24)) self.expand_all_btn = buttons.GenButton(self, label=" Expand All ") self.collapse_all_btn = buttons.GenButton(self, label=" Collapse All ") self.btn_sizer.Add(self.sort_filter_btn, 0, wx.EXPAND, 0) self.btn_sizer.Add(self.expand_all_btn, 0, wx.EXPAND, 0) self.btn_sizer.Add(self.collapse_all_btn, 0, wx.EXPAND, 0)
def _create_btn_sizer(self, parent): # Create Buttons # TODO: Tooltips and bindings btn_sizer = wx.BoxSizer(wx.HORIZONTAL) # TODO: Two lines. Top line has filter peaks, Peak number, combobox and arrows # Line two has hide peak (with eye icon), show hidden peaks, and show rsd button self.filter_peaks_btn = buttons.GenBitmapTextButton( self, -1, None, "Filter Peaks ") self.filter_peaks_btn.SetBitmapLabel(get_icon("data-filter", 24)) self.peak_number_combo = wx.ComboBox( parent, size=(100, -1), validator=CharValidator("int-only")) self.previous_peak_btn = buttons.GenBitmapButton(parent, bitmap=get_icon( wx.ART_GO_BACK, 24)) self.previous_peak_btn.SetToolTip("Previous Peak") self.next_peak_btn = buttons.GenBitmapButton(parent, bitmap=get_icon( wx.ART_GO_FORWARD, 24)) self.next_peak_btn.SetToolTip("Next Peak") btn_sizer.Add(self.filter_peaks_btn, 0, wx.EXPAND, 0) btn_sizer.AddSpacer(20) btn_sizer.Add(wx.StaticText(parent, label="Peak Number: "), 1, wx.ALIGN_CENTER_VERTICAL, 0) btn_sizer.Add(self.peak_number_combo, 0, wx.EXPAND, 0) btn_sizer.Add(self.previous_peak_btn, 0, wx.EXPAND, 0) btn_sizer.Add(self.next_peak_btn, 0, wx.EXPAND, 0) btn_sizer.AddSpacer(10) return btn_sizer
def _populate_toolbar(self): self.add_tool( ToolData( name="Export as PDF", icon=get_icon("export-pdf", tb_icon_size[0]), id=ID_Export_PDF, handler=self.parent.on_export_pdf, )) self.add_tool( ToolData( name="Print (Ctrl+P)", icon=get_icon("Document-print", tb_icon_size[0]), id=wx.ID_PRINT, handler=self.parent.on_print, )) self.add_tool( ToolData( name="Print Preview", icon=get_icon("Document-print-preview", tb_icon_size[0]), id=wx.ID_PREVIEW_PRINT, handler=self.parent.on_print_preview, ))
def _set_properties(self): # tell FrameManager to manage this frame self._mgr = aui.AuiManager(flags=wx.aui.AUI_MGR_LIVE_RESIZE | wx.aui.AUI_MGR_DEFAULT) self._mgr.SetManagedWindow(self) self.GunShotMatch_statusbar.SetStatusWidths([-2, -3]) # statusbar fields GunShotMatch_statusbar_fields = ["Ready", "Welcome to GunShotMatch"] for i in range(len(GunShotMatch_statusbar_fields)): self.GunShotMatch_statusbar.SetStatusText( GunShotMatch_statusbar_fields[i], i) _icon = wx.NullIcon _icon.CopyFromBitmap(get_icon("logo-v2", 256)) self.SetIcon(_icon)
def _create_hits_btn_sizer(self, parent): # Create Buttons # TODO: Tooltips and bindings btn_sizer = wx.BoxSizer(wx.HORIZONTAL) btn_sizer.Add(wx.StaticText(parent, label="Hits:"), 1, wx.ALIGN_BOTTOM | wx.LEFT, 8) self.filter_hits_btn = buttons.GenBitmapTextButton( self, -1, None, "Filter Hits ") self.filter_hits_btn.SetBitmapLabel(get_icon("data-filter", 24)) btn_sizer.Add(self.filter_hits_btn, 0, wx.EXPAND | wx.ALIGN_RIGHT, 0) btn_sizer.AddSpacer(20) return btn_sizer
def __init__( self, parent, id=wx.ID_ANY, title='', pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name=wx.DialogNameStr ): """ :param parent: Can be None, a frame or another dialog box. :type parent: wx.Window :param id: An identifier for the dialog. A value of -1 is taken to mean a default. :type id: wx.WindowID :param title: The title of the dialog. :type title: str :param pos: The dialog position. The value DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. :type pos: wx.Point :param style: The window style. :type style: int :param name: Used to associate a name with the window, allowing the application user to set Motif resource values for individual dialog boxes. :type name: str """ wx.Dialog.__init__( self, parent=parent, id=id, title=title, pos=pos, size=(468, 420), style=style | wx.DEFAULT_DIALOG_STYLE, name=name ) self.proj_report_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon("export_project_report", 110), "Project Report") self.expr_report_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon(wx.ART_REPORT_VIEW, 110), "Experiment Report") self.expr_data_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon("export_jdx", 110), "Experiment Data") self.method_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon("method", 110), "Method") self.ammo_details_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon("ammo-details", 110), "Ammo Details") self.current_view_pdf_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon("export-pdf", 110), "PDF") self.current_view_images_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon("export_images", 110), "Images") self.current_view_csv_btn = CustomBitmapButton(self, wx.ID_ANY, get_icon("LibreOffice_Calc", 110), "CSV") self._set_properties() self._do_layout() self._bind_events()
def __do_layout(self): # begin wxGlade: MethodEditorAboutDialog.__do_layout main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add((20, 20), 0, 0, 0) meth_editor_icon = wx.StaticBitmap(self, wx.ID_ANY, get_icon("method-editor", 64)) main_sizer.Add(meth_editor_icon, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.TOP, 3) meth_editor_label = wx.StaticText(self, wx.ID_ANY, "GunShotMatch Method Editor", style=wx.ALIGN_CENTER) meth_editor_label.SetFont( wx.Font(16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, "")) main_sizer.Add( meth_editor_label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.EXPAND | wx.TOP, 3) version_label = wx.StaticText(self, wx.ID_ANY, "Version <version string goes here>", style=wx.ALIGN_CENTER) main_sizer.Add(version_label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 10) copyright_label = wx.StaticText( self, wx.ID_ANY, u"Copyright © 2019-2020\nDominic Davis-Foster\nAll rights reserved.", style=wx.ALIGN_CENTER) main_sizer.Add(copyright_label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 20) self.SetSizer(main_sizer) self.Layout() # end wxGlade btns = self.CreateStdDialogButtonSizer(wx.OK) main_sizer.Add(btns, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM) self.SetSizer(main_sizer) self.Layout()
def __do_layout(self): # begin wxGlade: _WelcomeDialog.__do_layout outer_sizer = wx.BoxSizer(wx.HORIZONTAL) main_sizer = wx.BoxSizer(wx.VERTICAL) sizer_1 = wx.GridSizer(1, 2, 0, 0) bottom_sizer = wx.BoxSizer(wx.HORIZONTAL) bitmap_button_sizer = wx.GridSizer(1, 3, 0, 0) recent_project_grid = wx.GridSizer(1, 1, 0, 0) recent_project_grid.Add(self.recent_project_ctrl, 1, wx.EXPAND, 0) self.left_panel.SetSizer(recent_project_grid) outer_sizer.Add(self.left_panel, 2, wx.EXPAND, 5) GSM_Logo = wx.StaticBitmap(self.right_panel, wx.ID_ANY, get_icon("logo-v2", 128)) main_sizer.Add(GSM_Logo, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 20) gsm_label = wx.StaticText(self.right_panel, wx.ID_ANY, "GunShotMatch") gsm_label.SetFont(wx.Font(20, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, "")) main_sizer.Add(gsm_label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 15) main_sizer.Add(self.version_label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 5) main_sizer.Add((20, 20), 0, 0, 0) main_sizer.Add(self.new_project_button, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 10) main_sizer.Add(self.open_project_button, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) static_line_4 = wx.StaticLine(self.right_panel, wx.ID_ANY) main_sizer.Add(static_line_4, 0, wx.BOTTOM | wx.EXPAND | wx.TOP, 10) bitmap_button_sizer.Add(self.new_experiment_button, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) bitmap_button_sizer.Add(self.method_editor_button, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) bitmap_button_sizer.Add(self.ammo_editor_editor, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) main_sizer.Add(bitmap_button_sizer, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 0) sizer_1.Add(self.show_dialog_checkbox, 0, wx.ALIGN_BOTTOM | wx.LEFT | wx.RIGHT, 30) bottom_sizer.Add(self.settings_button, 0, wx.ALIGN_BOTTOM | wx.RIGHT, 5) bottom_sizer.Add(self.help_button, 0, wx.ALIGN_BOTTOM | wx.RIGHT, 10) sizer_1.Add(bottom_sizer, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT, 0) self.bottom_panel.SetSizer(sizer_1) main_sizer.Add(self.bottom_panel, 1, wx.ALIGN_RIGHT | wx.BOTTOM | wx.EXPAND, 5) self.right_panel.SetSizer(main_sizer) outer_sizer.Add(self.right_panel, 3, wx.BOTTOM | wx.EXPAND | wx.RIGHT | wx.TOP, 5) self.SetSizer(outer_sizer) self.Layout()
def __init__(self, *args, **kwds): """ :param parent: Can be None, a frame or another dialog box. :type parent: wx.Window :param id: An identifier for the dialog. A value of -1 is taken to mean a default. :type id: wx.WindowID :param title: The title of the dialog. :type title: str :param pos: The dialog position. The value DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. :type pos: wx.Point :param size: The dialog size. The value DefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. :type size: wx.Size :param style: The window style. :type style: int :param name: Used to associate a name with the window, allowing the application user to set Motif resource values for individual dialog boxes. :type name: str """ # begin wxGlade: PreferencesDialog.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.SetSize((680, 400)) self.preferences_notebook = wx.Notebook(self, wx.ID_ANY) self.general_page = wx.Panel(self.preferences_notebook, wx.ID_ANY) self.show_welcome_dialog = wx.CheckBox( self.general_page, wx.ID_ANY, "Show 'Welcome' Dialog when starting GunShotMatch") self.close_with_welcome_dialog = wx.CheckBox( self.general_page, wx.ID_ANY, "Exit GunShotMatch when closing 'Welcome' dialog") self.paths_page = wx.Panel(self.preferences_notebook, wx.ID_ANY) self.paths_panel = wx.Panel(self.paths_page, wx.ID_ANY) self.nistpath = DirBrowseCtrl(self.paths_panel, wx.ID_ANY, labelText='') self.nistpath_help = wx.BitmapButton(self.paths_panel, wx.ID_ANY, get_icon("information", 16)) self.resultspath = DirBrowseCtrl(self.paths_panel, wx.ID_ANY, labelText='') self.csvpath = DirBrowseCtrl(self.paths_panel, wx.ID_ANY, labelText='') self.spectrapath = DirBrowseCtrl(self.paths_panel, wx.ID_ANY, labelText='') self.msppath = DirBrowseCtrl(self.paths_panel, wx.ID_ANY, labelText='') self.charts_path = DirBrowseCtrl(self.paths_panel, wx.ID_ANY, labelText='') self.chart_colours_page = wx.Panel(self.preferences_notebook, wx.ID_ANY) self.colour_picker = ColourPickerPanel( self.chart_colours_page, wx.ID_ANY, selection_choices=internal_config.chart_colours) self.chart_markers_page = wx.Panel(self.preferences_notebook, wx.ID_ANY) self.marker_picker = StylePickerPanel( self.chart_markers_page, wx.ID_ANY, selection_choices=internal_config.chart_styles) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_nistpath_help, self.nistpath_help) # end wxGlade # Populate the settings self.load_preferences() self.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_OK)
def __init__(self, parent, project, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name="AlignmentDataPanel"): """ TODO: Does this need to be a sorter panel or would a simple listctrl suffice? :param parent: The parent window. :type parent: wx.Window :param project: :type project: :param id: An identifier for the panel. ID_ANY is taken to mean a default. :type id: wx.WindowID, optional :param pos: The panel position. The value wx.DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. :type pos: wx.Point, optional :param size: The panel size. The value wx.DefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. :type size: wx.Size, optional :param style: The window style. See wx.Panel. :type style: int, optional :param name: Window name :type name: str, optional """ args = (parent, id) kwds = dict(pos=pos, size=size, style=style, name=name) self.parent = parent self.project = project # begin wxGlade: AlignmentDataPanel.__init__ kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL wx.Panel.__init__(self, *args, **kwds) self.filter_button = wx.BitmapButton(self, wx.ID_ANY, get_icon("data-filter", 32)) self.alignment_table = SorterPanels.SorterPanel(self, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_filter_peaks, self.filter_button) # end wxGlade self.alignment_table.AppendColumn("Peak No.", format=wx.LIST_FORMAT_LEFT, width=80) for experiment in self.project.experiment_name_list: self.alignment_table.AppendColumn(experiment, format=wx.LIST_FORMAT_RIGHT, width=120) self.Bind(SorterPanels.myEVT_SORTER_PANEL_DCLICK, self.on_item_dclick) self.Bind(SorterPanels.myEVT_SORTER_PANEL_RCLICK, self.on_right_click) self.Bind(wx.EVT_BUTTON, self.apply_filter, id=wx.ID_APPLY) self.Bind(wx.EVT_BUTTON, self.apply_filter, id=wx.ID_OK) self.default_filter_settings() self._populate_table() self.filter_dialog = Project.AlignmentFilterDialog(self)
def __init__(self, *args, **kwds): """ # TODO: Cannot get to the recent project list using tab traversal :param parent: Can be None, a frame or another dialog box. :type parent: wx.Window :param id: An identifier for the dialog. A value of -1 is taken to mean a default. :type id: wx.WindowID :param title: The title of the dialog. :type title: str :param pos: The dialog position. The value DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. :type pos: wx.Point :param size: The dialog size. The value DefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. :type size: wx.Size :param style: The window style. :type style: int :param name: Used to associate a name with the window, allowing the application user to set Motif resource values for individual dialog boxes. :type name: str """ # begin wxGlade: _WelcomeDialog.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX wx.Dialog.__init__(self, *args, **kwds) self.SetSize((777, 460)) self.left_panel = wx.Panel(self, wx.ID_ANY) self.recent_project_ctrl = PanelListCtrl(self.left_panel, wx.ID_ANY, style=wx.NO_BORDER) self.right_panel = wx.Panel(self, wx.ID_ANY) self.version_label = wx.StaticText(self.right_panel, wx.ID_ANY, "Version <version>") self.new_project_button = wx.Button(self.right_panel, wx.ID_ANY, u"➕ Create New Project", style=wx.BORDER_NONE | wx.BU_LEFT) self.open_project_button = wx.Button(self.right_panel, wx.ID_ANY, u"📂 Open Project", style=wx.BORDER_NONE | wx.BU_LEFT) self.new_experiment_button = wx.BitmapButton(self.right_panel, wx.ID_ANY, get_icon("new-experiment", 24)) self.method_editor_button = wx.BitmapButton(self.right_panel, wx.ID_ANY, get_icon("method-editor",24)) self.ammo_editor_editor = wx.BitmapButton(self.right_panel, wx.ID_ANY, get_icon("ammo-details",32)) self.bottom_panel = wx.Panel(self.right_panel, wx.ID_ANY) self.show_dialog_checkbox = wx.CheckBox(self.bottom_panel, wx.ID_ANY, "Show this dialog at startup") self.settings_button = wx.Button(self.bottom_panel, wx.ID_ANY, u"⚙ Settings", style=wx.BORDER_NONE) self.help_button = wx.Button(self.bottom_panel, wx.ID_HELP, "", style=wx.BORDER_NONE) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnCreateProject, self.new_project_button) self.Bind(wx.EVT_BUTTON, self.OnOpenProject, self.open_project_button) self.Bind(wx.EVT_BUTTON, self.on_new_experiment, self.new_experiment_button) self.Bind(wx.EVT_BUTTON, self.on_method_editor, self.method_editor_button) self.Bind(wx.EVT_BUTTON, self.on_ammo_editor, self.ammo_editor_editor) self.Bind(wx.EVT_CHECKBOX, self.on_toggle_show_dialog, self.show_dialog_checkbox) self.Bind(wx.EVT_BUTTON, self.on_settings, self.settings_button) self.Bind(wx.EVT_BUTTON, self.on_help, self.help_button) # end wxGlade self.recent_project_ctrl.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnOpenRecent) self.recent_project_ctrl.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightDown) self.recent_project_ctrl.Bind(wx.EVT_LIST_KEY_DOWN, self.OnKeyDown) self.recent_project_ctrl.Bind(wx.EVT_LIST_DELETE_ITEM, self.OnItemRemoved) # self.recent_project_ctrl.Bind(wx.EVT_LEFT_DCLICK, self.OnOpenRecent) # self.Bind(ULC.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.recent_project_ctrl) # self.recent_project_ctrl.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) # # # for wxMSW # self.recent_project_ctrl.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRecentRightClick) # # # for wxGTK # self.recent_project_ctrl.Bind(wx.EVT_RIGHT_UP, self.OnRecentRightClick) # # self.Bind(wx.EVT_CLOSE, self.OnClose) self.selected_project = None self._setup_context_menu()
def get_b64_icon(icon_name): icon = get_icon(icon_name, 24) buf = BytesIO() icon.ConvertToImage().SaveFile(buf, "image/png") return base64.b64encode(buf.getvalue()).decode("utf-8")
def _populate_toolbar(self): self.add_tool( ToolData( name="Reset View", icon=get_icon(wx.ART_GO_HOME, tb_icon_size[0]), id=ID_View_Reset, )) self.add_tool( ToolData( name="Previous View", icon=get_icon(wx.ART_GO_TO_PARENT, tb_icon_size[0]), id=ID_View_Previous, )) self.add_tool( ToolData( name="Rescale y-axis", icon=get_icon("rescale_y", tb_icon_size[0]), id=ID_View_Rescale_y, )) self.add_tool( ToolData( name="Rescale x-axis", icon=get_icon("rescale_x", tb_icon_size[0]), id=ID_View_Rescale_x, )) self.AddSeparator() self.add_radio_tool( ToolData( name="Select", icon=get_icon("default-cursor", 24), id=ID_View_Default, )) self.add_radio_tool( ToolData( name="Zoom (Ctrl+Shift+Z)", icon=get_icon("zoom", 24), id=ID_View_Zoom, )) self.add_radio_tool( ToolData( name="Pan (Ctrl+Shift+P)", icon=get_icon("gimp-tool-move", 24), id=ID_View_Pan, )) self.add_radio_tool( ToolData("View Spectrum On Click (Ctrl+Shift+S)", get_icon("mass-spectrum", 24), ID_View_Spectrum)) # TODO: Dropdown with options for Click to view, enter scan No, enter RT self.add_tool( ToolData( name="View Spectrum By Scan No.", icon=get_icon("mass-spectrum-123", tb_icon_size[0]), id=ID_View_Spectrum_by_num, )) self.add_tool( ToolData( name="View Spectrum By RT", icon=get_icon("mass-spectrum-rt", tb_icon_size[0]), id=ID_View_Spectrum_by_rt, ))
def setup_image_list(self): self.imglist = wx.ImageList(16, 16, True, 2) self.proj_collapsed_icon = self.imglist.Add(get_icon( wx.ART_FOLDER, 16)) # 0 self.proj_expanded_icon = self.imglist.Add( get_icon(wx.ART_FILE_OPEN, 16)) # 1 self.info_icon = self.imglist.Add(get_icon(wx.ART_INFORMATION, 16)) # 2 self.method_icon = self.imglist.Add(get_icon("method", 16)) # 3 - don't move self.peak_list_icon = self.imglist.Add(get_icon(wx.ART_LIST_VIEW, 16)) # 4 self.data_icon = self.imglist.Add(get_icon(wx.ART_EXECUTABLE_FILE, 16)) # 5 self.tic_icon = self.imglist.Add(get_icon("chromatogram", 16)) # 6 self.ammo_icon = self.imglist.Add(get_icon("ammo-details", 16)) # 7 - don't move self.alignment_icon = self.imglist.Add(get_icon(wx.ART_LIST_VIEW, 16)) # 8 self.compounds_icon = self.imglist.Add( get_icon("Conical_flask_red", 16)) # 9 self.expr_icon = self.imglist.Add(get_icon(wx.ART_REPORT_VIEW, 16)) # 10 self.consolidate_icon = self.imglist.Add(get_icon( "Merge-arrows-3", 16)) # 11 self.AssignImageList(self.imglist)
def get_new_expr_icon(): icon = get_icon("new-experiment", 24) buf = BytesIO() icon.ConvertToImage().SaveFile(buf, "image/png") return base64.b64encode(buf.getvalue()).decode("utf-8")