def parse(self, ks, vs, pt, short, rst): page = rb.RibbonPage(self, wx.ID_ANY, ks, wx.NullBitmap, 0) panel = toolbar = None for kv1 in vs: if len(kv1) == 2: kv1 = (kv1[0], None, kv1[1]) if kv1 == '-': continue pname = kv1[0] if isinstance(kv1[2], list) else '--' if panel is None and not isinstance(kv1[2], list): panel = rb.RibbonPanel(page, wx.ID_ANY, pname, make_logo(kv1[1] or kv1[0][0]), wx.DefaultPosition, wx.DefaultSize, rb.RIBBON_PANEL_DEFAULT_STYLE) toolbar = rb.RibbonButtonBar(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) if not isinstance(kv1[2], list): btn = toolbar.AddSimpleButton(wx.NewId(), kv1[0], make_logo(kv1[1] or kv1[0][0]), wx.EmptyString) toolbar.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, lambda e, p=kv1[2]: p().start(self.app), id=btn.id) self.GetParent().Bind(wx.EVT_MENU, lambda e, p=kv1[2]: p().start(self.app), id=btn.id) if kv1[0] in short: rst.append((short[kv1[0]], btn.id)) else: panel = rb.RibbonPanel(page, wx.ID_ANY, pname, make_logo(kv1[1] or kv1[0][0]), wx.DefaultPosition, wx.DefaultSize, rb.RIBBON_PANEL_DEFAULT_STYLE) toolbar = rb.RibbonButtonBar(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) for kv2 in kv1[2]: if len(kv2) == 2: kv2 = (kv2[0], None, kv2[1]) if kv2 == '-': continue btn = toolbar.AddSimpleButton( wx.NewId(), kv2[0], make_logo(kv2[1] or kv2[0][0]), wx.EmptyString) toolbar.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, lambda e, p=kv2[2]: p().start(self.app), id=btn.id) self.GetParent().Bind( wx.EVT_MENU, lambda e, p=kv2[2]: p().start(self.app), id=btn.id) if kv2[0] in short: rst.append((short[kv2[0]], btn.id)) panel = toolbar = None self.Realize()
def panel_project_properties(self, page): project_properties_panel = RB.RibbonPanel( page, wx.ID_ANY, 'PROPERTIES', wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) project_properties_sizer = wx.BoxSizer(wx.VERTICAL) tb = RB.RibbonButtonBar(project_properties_panel, wx.ID_ANY) tb.SetCursor(wx.Cursor(wx.CURSOR_HAND)) project_properties_sizer.Add(tb, 0, wx.EXPAND) icon_information = wx.Bitmap( os.path.join(os.getcwd(), 'gui', 'assets', 'icons', 'ribbon', 'gantt', 'project_information.png')) tb.AddSimpleButton(self.IDS.PROJECT_INFORMATION, 'Project Information', icon_information, 'Project basic information.') icon_settings = wx.Bitmap( os.path.join(os.getcwd(), 'gui', 'assets', 'icons', 'ribbon', 'gantt', 'project_settings.png')) tb.AddSimpleButton(self.IDS.PROJECT_SETTINGS, 'Settings', icon_settings, 'Project Settings') self.Bind(self.ribbon_button_bar_event, self.on_project_information_clicked, id=self.IDS.PROJECT_INFORMATION) tb.Realize() project_properties_panel.SetSizer(project_properties_sizer)
def AddChangeModePanel(self,home_page): chmode_panel = RB.RibbonPanel(home_page, wx.ID_ANY, "Editor mode", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) chmode = RB.RibbonButtonBar(chmode_panel, wx.ID_ANY) icon_normal = wx.Bitmap(os.path.join(self.bitmap_action_dir, "transform-crop-and-resize.png"), wx.BITMAP_TYPE_PNG) icon_closure = wx.Bitmap(os.path.join(self.bitmap_action_dir, "transmission.png"), wx.BITMAP_TYPE_PNG) chmode.AddSimpleButton(ID_MODE_TRACK_NORMAL, "Normal", icon_normal, "") chmode.AddSimpleButton(ID_MODE_TRACK_CLOSURE, "Closure", icon_closure, "")
def panel_project_file(self, page): # -- File Panel -- # project_file_panel = RB.RibbonPanel( page, wx.ID_ANY, 'FILE', wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) project_general_sizer = wx.BoxSizer(wx.VERTICAL) tb = RB.RibbonButtonBar(project_file_panel) tb.SetCursor(wx.Cursor(wx.CURSOR_HAND)) project_general_sizer.Add(tb, 0, wx.EXPAND) # New project icon_new_project = wx.ArtProvider.GetBitmap( wx.ART_NEW, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.NEW_PROJECT, 'New Project', icon_new_project, 'Create new project.') self.Bind(self.ribbon_button_bar_event, self.on_new_project, id=self.IDS.NEW_PROJECT) # Open project icon_open_project = wx.ArtProvider.GetBitmap( wx.ART_FILE_OPEN, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.OPEN_PROJECT, 'Open Project', icon_open_project, 'Open a project file.') self.Bind(self.ribbon_button_bar_event, self.on_open_project, id=self.IDS.OPEN_PROJECT) # Save project icon_save_project = wx.ArtProvider.GetBitmap( wx.ART_FILE_SAVE, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.SAVE_PROJECT, 'Save Project', icon_save_project, 'Save project file.') self.Bind(self.ribbon_button_bar_event, self.on_save_project, id=self.IDS.SAVE_PROJECT) # Save as project icon_save_project_as = wx.ArtProvider.GetBitmap( wx.ART_FILE_SAVE_AS, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.SAVE_AS_PROJECT, 'Save Project as', icon_save_project_as, 'Save project as new file.') self.Bind(self.ribbon_button_bar_event, self.on_save_project_as, id=self.IDS.SAVE_AS_PROJECT) tb.Realize() project_file_panel.SetSizer(project_general_sizer)
def AddNavigationPanel(self,home_panel): #pole dla nawigacji navi_panel = RB.RibbonPanel(home_panel,wx.ID_ANY,"Navigtion",wx.NullBitmap) navi = RB.RibbonButtonBar(navi_panel, wx.ID_ANY) icon_centerat = wx.Bitmap(os.path.join(self.bitmap_action_dir, "view-restore.png"), wx.BITMAP_TYPE_PNG) icon_zoomin = wx.Bitmap(os.path.join(self.bitmap_action_dir, "zoom-in.png"), wx.BITMAP_TYPE_PNG) icon_zoomout = wx.Bitmap(os.path.join(self.bitmap_action_dir, "zoom-out.png"), wx.BITMAP_TYPE_PNG) navi.AddSimpleButton(ID_CENTER_AT, "Center at", icon_centerat, "") navi.AddSimpleButton(wx.ID_ZOOM_IN, "Zoom in", icon_zoomin, "") navi.AddSimpleButton(wx.ID_ZOOM_OUT, "Zoom out", icon_zoomout, "")
def AddHistoryPanel(self,home_panel): #pole usuwania delete_panel = RB.RibbonPanel(home_panel, wx.ID_ANY, "Edit", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) delete_bb = RB.RibbonButtonBar(delete_panel, wx.ID_ANY) icon_delete = wx.Bitmap(os.path.join(self.bitmap_action_dir, "edit-delete.png"), wx.BITMAP_TYPE_PNG) icon_undo = wx.Bitmap(os.path.join(self.bitmap_action_dir, "edit-undo.png"), wx.BITMAP_TYPE_PNG) icon_redo = wx.Bitmap(os.path.join(self.bitmap_action_dir, "edit-redo.png"), wx.BITMAP_TYPE_PNG) delete_bb.AddSimpleButton(wx.ID_DELETE, "Delete", icon_delete, "") delete_bb.AddSimpleButton(wx.ID_UNDO, "Undo", icon_undo, "") delete_bb.AddSimpleButton(wx.ID_REDO, "Redo", icon_redo, "")
def AddInsertPanel(self,home_panel): # w panelu Edit tworzymy pole wstawiania insert_panel = RB.RibbonPanel(home_panel, wx.ID_ANY, "Insert", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) insert = RB.RibbonButtonBar(insert_panel, wx.ID_ANY) icon_insert_track = wx.Bitmap(os.path.join(self.bitmap_action_dir, "editor-switch.png"), wx.BITMAP_TYPE_PNG) #icon_insert_curve = wx.Bitmap(os.path.join(self.bitmap_action_dir, "document-new.png"), wx.BITMAP_TYPE_PNG) #icon_save = wx.Bitmap(os.path.join(self.bitmap_action_dir, "document-save.png"), wx.BITMAP_TYPE_PNG) #icon_saveas = wx.Bitmap(os.path.join(self.bitmap_action_dir, "media-floppy.png"), wx.BITMAP_TYPE_PNG) #icon_export = wx.Bitmap(os.path.join(self.bitmap_action_dir, "application-x-bittorrent.png"), wx.BITMAP_TYPE_PNG) insert.AddSimpleButton(ID_INSERT_TRACK, "Track", icon_insert_track, "") insert.AddSimpleButton(ID_INSERT_CURVE, "Curve", icon_insert_track, "") insert.AddSimpleButton(ID_INSERT_SWITCH, "Switch", icon_insert_track, "")
def AddFilePanel(self,home_panel): # w panelu Home tworzymy nowe pole filetools_panel = RB.RibbonPanel(home_panel, wx.ID_ANY, "File", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) file_tools = RB.RibbonButtonBar(filetools_panel, wx.ID_ANY) # dodajemy przyciski podstawowe #print os.path.join(bitmapDir, "document-open.png") icon_open = wx.Bitmap(os.path.join(self.bitmap_action_dir, "document-open.png"), wx.BITMAP_TYPE_PNG) icon_new = wx.Bitmap(os.path.join(self.bitmap_action_dir, "document-new.png"), wx.BITMAP_TYPE_PNG) icon_save = wx.Bitmap(os.path.join(self.bitmap_action_dir, "document-save.png"), wx.BITMAP_TYPE_PNG) icon_saveas = wx.Bitmap(os.path.join(self.bitmap_action_dir, "media-floppy.png"), wx.BITMAP_TYPE_PNG) icon_export = wx.Bitmap(os.path.join(self.bitmap_action_dir, "application-x-bittorrent.png"), wx.BITMAP_TYPE_PNG) #self.ResizeBitmap(icon_open,wx.Size(32,32)) file_tools.AddSimpleButton(wx.ID_NEW, "New", icon_new, "New scenery") file_tools.AddSimpleButton(wx.ID_OPEN, "Open",icon_open,"Open scenery") file_tools.AddSimpleButton(wx.ID_SAVE, "Save", icon_save,"Save") file_tools.AddSimpleButton(wx.ID_SAVEAS, "Save as...", icon_saveas,"Save as...") file_tools.AddSimpleButton(ID_EXPORT, "Export", icon_export, "Export to binary file")
def __init__(self, parent_page, title, kind=ToolbarPanel.TYPE_PANEL_TOOLBAR): RB.RibbonPanel.__init__( self, parent_page, wx.ID_ANY, title, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE, ) ToolbarPanel.__init__(self, parent_page, title, kind) if self.kind == ToolbarPanel.TYPE_PANEL_TOOLBAR: self.toolbar = RB.RibbonToolBar(self) # self.toolbar = SchRibbonToolBar(self) elif self.kind == ToolbarPanel.TYPE_PANEL_BUTTONBAR: self.toolbar = RB.RibbonButtonBar(self)
def panel_gantt_edit(self, page): panel = RB.RibbonPanel(page, wx.ID_ANY, 'EDIT', wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) tb = RB.RibbonButtonBar(panel) tb.SetCursor(wx.Cursor(wx.CURSOR_HAND)) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(tb, 0, wx.EXPAND) icon_split = wx.Bitmap( os.path.join(os.getcwd(), 'gui', 'assets', 'icons', 'ribbon', 'gantt', 'split.png')) tb.AddSimpleButton(self.IDS.SPLIT_TASK, 'Split Task', icon_split, 'Split a task segment.') self.Bind(self.ribbon_button_bar_event, self.on_split_task, id=self.IDS.SPLIT_TASK) icon_merge = wx.Bitmap( os.path.join(os.getcwd(), 'gui', 'assets', 'icons', 'ribbon', 'gantt', 'merge.png')) tb.AddSimpleButton(self.IDS.MERGE_SEGMENTS, 'Merge Task Segments', icon_merge, 'Merge all task segments.') self.Bind(self.ribbon_button_bar_event, self.on_merge_segments, id=self.IDS.MERGE_SEGMENTS) icon_edit_start = wx.Bitmap( os.path.join(os.getcwd(), 'gui', 'assets', 'icons', 'ribbon', 'gantt', 'edit_start.png')) tb.AddSimpleButton(self.IDS.MOVE_SEGMENT, 'Move Task Segment', icon_edit_start, 'Move the task segment start.') self.Bind(self.ribbon_button_bar_event, self.on_move_segment, id=self.IDS.MOVE_SEGMENT) icon_move_up = wx.ArtProvider.GetBitmap(wx.ART_GO_UP) tb.AddSimpleButton(self.IDS.MOVE_UP, 'Move Up', icon_move_up, 'Move a task up by one row.') self.Bind(self.ribbon_button_bar_event, self.on_task_move_up, id=self.IDS.MOVE_UP) icon_move_down = wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN) tb.AddSimpleButton(self.IDS.MOVE_DOWN, 'Move Down', icon_move_down, 'Move a task down by one row.') self.Bind(self.ribbon_button_bar_event, self.on_task_move_down, id=self.IDS.MOVE_DOWN) icon_undo = wx.ArtProvider.GetBitmap(wx.ART_UNDO) tb.AddSimpleButton(self.IDS.UNDO, 'Undo', icon_undo, 'Undo task action.') self.Bind(self.ribbon_button_bar_event, self.on_undo, id=self.IDS.UNDO) icon_redo = wx.ArtProvider.GetBitmap(wx.ART_REDO) tb.AddSimpleButton(self.IDS.REDO, 'Redo', icon_redo, 'Redo previous undo action.') self.Bind(self.ribbon_button_bar_event, self.on_redo, id=self.IDS.REDO) panel.SetSizer(sizer) tb.Realize()
def panel_gantt_basic(self, page): # -- Task Panel -- # gantt_task_panel = RB.RibbonPanel( page, wx.ID_ANY, 'BASIC', wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) gantt_page_sizer = wx.BoxSizer(wx.VERTICAL) tb = RB.RibbonButtonBar(gantt_task_panel) tb.SetCursor(wx.Cursor(wx.CURSOR_HAND)) gantt_page_sizer.Add(tb, 0, wx.EXPAND) # Add task button icon_add_task = wx.ArtProvider.GetBitmap(wx.ART_PLUS, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.ADD_TASK, 'Add New Task', icon_add_task, 'Add new task to the project.') self.Bind(self.ribbon_button_bar_event, self.on_add_task, id=self.IDS.ADD_TASK) # Delete task button icon_delete_task = self.get_stock_bitmap(wx.ART_MINUS, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.DELETE_TASK, 'Delete Task', icon_delete_task, 'Remove the selected task from project.') self.Bind(self.ribbon_button_bar_event, self.on_delete_task, id=self.IDS.DELETE_TASK) # tb.Add() # Outdent task button icon_outdent_task = wx.ArtProvider.GetBitmap( wx.ART_GO_BACK, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.OUTDENT_TASK, 'Outdent Task', icon_outdent_task, 'Remove the task from the immediate parent.') self.Bind(self.ribbon_button_bar_event, self.on_outdent_task, id=self.IDS.OUTDENT_TASK) # Indent task button icon_indent_task = wx.ArtProvider.GetBitmap( wx.ART_GO_FORWARD, size=self.RIBBON_BUTTON_SIZE) tb.AddSimpleButton(self.IDS.INDENT_TASK, 'Indent Task', icon_indent_task, 'Set the above task as parent.') self.Bind(self.ribbon_button_bar_event, self.on_indent_task, id=self.IDS.INDENT_TASK) tb.Realize() gantt_task_panel.SetSizer(gantt_page_sizer)
def _init_ctrls(self, prnt): RB.RibbonBar.__init__( self, name='ribbon', parent=prnt, id=wxID_PANEL1) #, agwStyle = RB.RIBBON_BAR_ALWAYS_SHOW_TABS) #self.GetArtProvider().SetColourScheme("GRAY","LIGHT GRAY","WHITE") self.SetArtProvider(RB.RibbonAUIArtProvider()) self.SetFont( wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) fileMenu = RB.RibbonPage(self, wxID_FileMenu, "File", CreateBitmap("images\\3d graph.png")) #----PlotMenu------------- #self.ribbon= RB.RibbonBar(parent=self, id=wx.ID_ANY, name ='ribbon') home = RB.RibbonPage(self, wx.ID_ANY, "Plot", CreateBitmap("images\\3d graph.png")) #------Plot Type --------------------------------------------------------------------------- plot_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plots", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) plots_bar = RB.RibbonButtonBar(plot_panel, wx.ID_ANY) plots_bar.AddSimpleButton(wxID_RIBBONPLOTTIMESERIES, "Time Series", CreateBitmap("images\\TSA_icon.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, "Probablity", CreateBitmap("images\\Probability.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, "Histogram", CreateBitmap("images\\Histogram.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, "Box/Whisker", CreateBitmap("images\\BoxWisker.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, "Summary", CreateBitmap("images\\Summary.png"), "") #-- PLOT OPTIONS----------------------------------------------------------------------------- PlotOptions_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plot Options", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.PlotsOptions_bar = RB.RibbonButtonBar(PlotOptions_panel, wx.ID_ANY) self.PlotsOptions_bar.AddDropdownButton( wxID_RIBBONPLOTTSTYPE, "Plot Type", CreateBitmap("images\\PlotType.png"), "") # self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSCOLOR, "Color Setting", # CreateBitmap("images\\ColorSetting.png"), "") self.PlotsOptions_bar.AddSimpleButton( wxID_RIBBONPLOTTSLEGEND, "Show Legend", CreateBitmap("images\\Legend.png"), help_string="show legend on plot", kind=0x4) self.PlotsOptions_bar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "# Hist Bins", CreateBitmap("images\\Blank.png"), "") #,wx.Size(100, 21)) self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTDATESTART, False) self.spnBins = wx.SpinCtrl( id=wxID_FRAME1SPINCTRL1, initial=50, max=100, min=1, name='spnBins', parent=self.PlotsOptions_bar, #pos=wx.Point(126, 6), #with color button included pos=wx.Point(84, 6), #without color button size=wx.Size(43, 25), style=wx.SP_ARROW_KEYS) # self.spnBins.SetValue(50) self.spnBins.Enabled = False self.PlotsOptions_bar.AddDropdownButton( wxID_RIBBONPLOTBOXTYPE, "Box Whisker Type", CreateBitmap("images\\BoxWhiskerType.png"), "") self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False) # self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSCOLOR, False) self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, False) self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBOXTYPE, False) ######################TEMPORARILY COMMENTED OUT # self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTHISTTYPE, "Histogram Type", # CreateBitmap("images\\HisType.png"), "") # self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTHISTBIN, "Binning Algorithms", # CreateBitmap("images\\Binning.png"), "") #------------------------------------------------------------------------------- dateTime_panel = RB.RibbonPanel(home, wx.ID_ANY, "Date Time", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) #radio1 = wx.RadioButton( dummy_2, -1, " Radio1 ", style =wx.RB_GROUP ) # dateTime_toolbar= RB.RibbonToolBar(dateTime_panel) dateTime_buttonbar = RB.RibbonButtonBar(dateTime_panel) # dateTime_buttonbar.AddHybridButton( wxID_RIBBONPLOTDATESTART, "Start" ,CreateBitmap("images\\Calendar.png"), "") #,wx.Size(100, 21)) # dateTime_buttonbar.AddHybridButton( wxID_RIBBONPLOTDATEEND, "End" ,CreateBitmap("images\\Calendar.png"), "") #,wx.Size(100, 21)) # dateTime_buttonbar.AddTool(wxID_RIBBONPLOTDATESTART, CreateBitmap("images\\Calendar.png"), kind=pnlDatePicker.pnlDatePicker, client_data=[wxID_RIBBONPLOTDATESTART, "startDate", "Start Date", wx.DateTimeFromDMY(30, 10, 2010, 0, 0, 0)]) ###Filler buttons to allow enough room for start and end date drop down menus dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATESTART, "", CreateBitmap("images\\Blank.png"), "") #,wx.Size(100, 21)) dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATESTART, "", CreateBitmap("images\\Blank.png"), "") #,wx.Size(100, 21)) dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATESTART, "", CreateBitmap("images\\Blank.png"), "") #,wx.Size(100, 21)) dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATESTART, False) # self.staticText2 = wx.StaticText(id=wx.ID_ANY, # label=u'Start Date:', name='staticText2', parent=dateTime_buttonbar, # pos=wx.Point(0, 16), size=wx.Size(55, 13), style=0) self.dpStartDate = wx.DatePickerCtrl(id=wxID_STARTDPDATE, name=u'dpStartDate', parent=dateTime_buttonbar, pos=wx.Point(5, 8), size=wx.Size(120, 24), style=wx.DP_DROPDOWN) self.dpStartDate.SetValue(wx.DateTimeFromDMY( 16, 1, 2008, 0, 0, 0)) #wx.DateTimeFromDMY(30, 10, 2010, 0, 0, 0) self.dpStartDate.SetLabel( repr(wx.DateTimeFromDMY( 16, 1, 2008, 0, 0, 0))) #.strftime("%m-%d-%Y"))#"%Y-%m-%d'"")#'11/30/2010' self.dpStartDate.SetToolTipString(u'Start Date') # self.staticText1 = wx.StaticText(id=wx.ID_ANY, # label=u'End Date:', name='staticText1', parent=dateTime_buttonbar, # pos=wx.Point(0, 48), size=wx.Size(49, 13), style=0) self.dpEndDate = wx.DatePickerCtrl(id=wxID_ENDDPDATE, name=u'dpEndDate', parent=dateTime_buttonbar, pos=wx.Point(5, 40), size=wx.Size(120, 24), style=wx.DP_DROPDOWN) self.dpEndDate.SetValue(wx.DateTimeFromDMY( 01, 04, 2008, 0, 0, 0)) #wx.DateTimeFromDMY(30, 10, 2010, 0, 0, 0) self.dpEndDate.SetLabel(repr(wx.DateTimeFromDMY( 1, 04, 2008, 0, 0, 0))) #.strftime("%m-%d-%Y"))#"%Y-%m-%d'"")#'11/30/2010' self.dpEndDate.SetToolTipString(u'End Date') dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATEREFRESH, "Refresh", CreateBitmap("images\\DateSetting.png"), "") dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATEFULL, "Full Date Range", CreateBitmap("images\\FullDateRange.png"), "") #------------------------------------------------------------------------------- editPage = RB.RibbonPage(self, wx.ID_ANY, "Edit", CreateBitmap("images\\Brush.png")) main_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Main", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.main_bar = RB.RibbonButtonBar(main_panel) self.main_bar.AddSimpleButton( wxID_RIBBONEDITSERIES, "Edit Series", bitmap=CreateBitmap("images\\Edit (2).png"), help_string="", kind=0x4) # self.main_bar.AddButton(wxID_RIBBONEDITSERIES, "Edit Series", # bitmap=CreateBitmap("images\\Edit (2).png"), help_string="", kind = 0x4) # self.main_bar.AddSimpleButton(wxID_RIBBONSTOPEDITSERIES, "Stop Editing", # CreateBitmap("images\\StopEdit.png"), "") # main_bar.AddSimpleButton(wxID_RIBBONEDITDERIVE, "Derive New Series", # CreateBitmap("images\\DeriveNewSeries.png"), "") self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, "Restore", CreateBitmap("images\\Restore.png"), "") self.main_bar.AddHybridButton(wxID_RIBBONEDITSAVE, "Save", CreateBitmap("images\\Save Data.png"), "") self.main_bar.EnableButton(wxID_RIBBONEDITRESTORE, False) self.main_bar.EnableButton(wxID_RIBBONEDITSAVE, False) # self.main_bar.EnableButton(wxID_RIBBONSTOPEDITSERIES, False) #------------------------------------------------------------------------------ edit_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Edit Functions", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.edit_bar = RB.RibbonButtonBar(edit_panel) self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFILTER, "Filter Points", CreateBitmap("images\\Filter List.png"), "") self.edit_bar.AddSimpleButton( wxID_RIBBONEDITCHGVALUE, "Change Value", CreateBitmap("images\\EditView_icon.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE, "Interpolate", CreateBitmap("images\\Interpolate.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, "Linear Drift", CreateBitmap("images\\LinDrift.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, "Flag", CreateBitmap("images\\Flag.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, "Add Point", CreateBitmap("images\\Add (2).png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, "Delete Point", CreateBitmap("images\\Delete (3).png"), "") self.edit_bar.AddSimpleButton( wxID_RIBBONEDITRECORD, "Record", bitmap=CreateBitmap("images\\Record.png"), help_string="", kind=0x4) self.edit_bar.EnableButton(wxID_RIBBONEDITFILTER, False) self.edit_bar.EnableButton(wxID_RIBBONEDITCHGVALUE, False) self.edit_bar.EnableButton(wxID_RIBBONEDITINTEROPOLATE, False) self.edit_bar.EnableButton(wxID_RIBBONEDITLINFILTER, False) self.edit_bar.EnableButton(wxID_RIBBONEDITFLAG, False) self.edit_bar.EnableButton(wxID_RIBBONEDITADDPOINT, False) self.edit_bar.EnableButton(wxID_RIBBONEDITDELPOINT, False) self.edit_bar.EnableButton(wxID_RIBBONEDITRECORD, False) #------------------------------------------------------------------------------- # script_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Script", wx.NullBitmap, wx.DefaultPosition, # wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) # script_bar = RB.RibbonButtonBar(script_panel) # script_bar.AddSimpleButton(wxID_RIBBONEDITSCRIPTEXECUTE, "Execute", # CreateBitmap("images\\Window Enter.png"), "") # script_bar.AddSimpleButton(wxID_RIBBONEDITSCRIPTOPEN, "Open", # CreateBitmap("images\\Open file.png"), "") # script_bar.AddSimpleButton(wxID_RIBBONEDITSCRIPTNEW, "New", # CreateBitmap("images\\File New.png"), "") # script_bar.AddHybridButton(wxID_RIBBONEDITSCRIPTSAVE, "Save", # CreateBitmap("images\\Save (2).png"), "") #------------------------------------------------------------------------------- viewPage = RB.RibbonPage(self, wx.ID_ANY, "View", CreateBitmap("images\\Brush.png")) view_panel = RB.RibbonPanel(viewPage, wx.ID_ANY, "Tools", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) view_bar = RB.RibbonButtonBar(view_panel) view_bar.AddSimpleButton(wxID_RIBBONVIEWPLOT, "Plot", CreateBitmap("images\\Line Chart.png"), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, "Table", CreateBitmap("images\\Table.png"), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, "Series Selector", CreateBitmap("images\\Bitmap editor.png"), "") view_bar.AddSimpleButton( wxID_RIBBONVIEWCONSOLE, "Python Console", CreateBitmap("images\\Window Command Line.png"), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, "PythonScript", CreateBitmap("images\\Script.png"), "") self.CurrPage = 1 self.SetActivePageByIndex(self.CurrPage) self.BindEvents() Publisher.subscribe(self.toggleEditButtons, ("edit.EnableButtons"))
def setupRibbonBar(self): self._bitmap_creation_dc = wx.MemoryDC() self._colour_data = wx.ColourData() label_font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT) ###################################################################### ## Ribbon Tab: Config ###################################################################### config = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Platform") ## Panel: Config.Boundary config_boundary_panel = RB.RibbonPanel( config, wx.ID_ANY, "Boundary", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) config_boundary_selection = RB.RibbonButtonBar(config_boundary_panel, wx.ID_ANY) config_boundary_selection.AddSimpleButton(ID_CONFIG_REALM, "Realm", CreateBitmap("Cloud"), "Realm settings") config_boundary_selection.AddSimpleButton(ID_CONFIG_NETWORK_SCOPES, "Networks", CreateBitmap("Wrench"), "Network scopes") ## Panel: Config.PlatformConfiguration config_base_panel = RB.RibbonPanel( config, wx.ID_ANY, "Configuration", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) config_base_selection = RB.RibbonButtonBar(config_base_panel, wx.ID_ANY) config_base_selection.AddSimpleButton(ID_CONFIG_OSPARAMETERS, "OS Parameters", CreateBitmap("System"), "Base OS Parameters") config_base_selection.AddSimpleButton(ID_CONFIG_CONFIGGROUPS, "Config Groups", CreateBitmap("Components"), "Config Group settings") config_base_selection.AddSimpleButton(ID_CONFIG_DEFAULTCONFIG, "Default Config", CreateBitmap("BoxWhiteClosed"), "Default Config settings") ## Panel: Config.Accounts config_accounts_panel = RB.RibbonPanel( config, wx.ID_ANY, "Accounts", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) config_accounts_selection = RB.RibbonButtonBar(config_accounts_panel, wx.ID_ANY) config_accounts_selection.AddSimpleButton(ID_ACCOUNTS_CREDENTIALS, "Credentials", CreateBitmap("UserBlue"), "Protocol credentials") config_accounts_selection.AddSimpleButton(ID_ACCOUNTS_USERS, "API Users", CreateBitmap("User"), "API user accounts") ###################################################################### ## Ribbon Tab: Data ###################################################################### content = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Data") ## Panel: Data.Content content_objects_panel = RB.RibbonPanel(content, wx.ID_ANY, "Content") content_objects_selection = RB.RibbonButtonBar(content_objects_panel) content_objects_selection.AddSimpleButton(ID_BROWSE_OBJECTS, "Objects", CreateBitmap("DataFind"), "Objects in the database") content_objects_selection.AddSimpleButton( ID_BROWSE_VIEWS_SIMPLE, "Simple Queries", CreateBitmap("EyeGlasses"), "Query results in visual graph form") content_objects_selection.AddSimpleButton( ID_BROWSE_VIEWS_INPUT, "Input Driven", CreateBitmap("ChartDot"), "Input Driven Query results in visual graph form") content_objects_selection.AddSimpleButton(ID_CONFIG_INSERT_OBJECT, "Insert Object ", CreateBitmap("FormBlue"), "Manually insert an object") ## Panel: Data.Models content_models_panel = RB.RibbonPanel(content, wx.ID_ANY, "Models") content_models_selection = RB.RibbonButtonBar(content_models_panel) content_models_selection.AddSimpleButton(ID_MODELS_METADATA_INSERT, "Insert MetaData", CreateBitmap("Blueprint"), "Insert model blueprint") content_models_selection.AddSimpleButton(ID_MODELS_METADATA_UPDATE, "Update MetaData", CreateBitmap("BlueprintEdit"), "Update model blueprint") content_models_selection.AddSimpleButton( ID_MODELS_METADATA_DELETE, "Delete MetaData", CreateBitmap("BlueprintDelete"), "Delete model blueprint") content_models_selection.AddSimpleButton( ID_MODELS_VIEWS, "Views", CreateBitmap("Branch"), "Model presented in visual tree form") content_models_selection.AddSimpleButton( ID_MODELS_HISTORY, "Model History", CreateBitmap("History"), "Snapshots of models over time") content_models_selection.AddSimpleButton( ID_MODELS_META_HISTORY, "MetaData History", CreateBitmap("DataScroll"), "Snapshots of MetaData over time") ###################################################################### ## Ribbon Tab: Jobs ###################################################################### jobs = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Jobs") ## Panel: Jobs.View jobs_view_panel = RB.RibbonPanel( jobs, wx.ID_ANY, "View", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) jobs_view_selection = RB.RibbonButtonBar(jobs_view_panel, wx.ID_ANY) jobs_view_selection.AddSimpleButton(ID_JOBS_LIST, "Listing", CreateBitmap("TextList"), "Job listing") jobs_view_selection.AddSimpleButton(ID_JOBS_STATS, "Statistics", CreateBitmap("Info"), "Job statistics") jobs_view_selection.AddSimpleButton(ID_JOBS_SCHEDULE, "Schedules", CreateBitmap("DateTime"), "View job schedules") ## Panel: Jobs.Modify jobs_modify_panel = RB.RibbonPanel( jobs, wx.ID_ANY, "Modify", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) jobs_modify_selection = RB.RibbonButtonBar(jobs_modify_panel, wx.ID_ANY) jobs_modify_selection.AddSimpleButton(ID_JOBS_TOGGLE, "Toggle", CreateBitmap("Replace"), "Enable/Disable jobs") jobs_modify_selection.AddSimpleButton(ID_JOBS_EDIT, "Config", CreateBitmap("ControlPanel"), "Edit job configurations") self._bitmap_creation_dc.SetFont(label_font) self._ribbon.Realize() return [ jobs_view_panel, jobs_modify_panel, config_accounts_panel, config_boundary_panel, config_base_panel, content_models_panel, content_objects_panel ]
def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): self.frame = wx.Frame.__init__(self, parent, id, title, pos, size, style) # Initiate parent window self.SetIcon(wx.Icon("Icons/Pie.ico", wx.BITMAP_TYPE_ICO)) # Set window icon self.ribbon = RB.RibbonBar(self, -1) # Initiate Ribbon Bar self.CreateStatusBar() # Initiate Status Bar ### ------------------------------------------- Home Tab: id = 100 -------------------------------------------- ### home = RB.RibbonPage(self.ribbon, -1, "Home") # Home tab on bar filePanel = RB.RibbonPanel(home, -1, "File") # File menu fileBar = RB.RibbonButtonBar(filePanel) fileBar.AddSimpleButton(101, "New", wx.Bitmap("Icons/stock_new.png", wx.BITMAP_TYPE_PNG), "") # New document fileBar.AddSimpleButton(102, "Open", wx.Bitmap("Icons/stock_open.png", wx.BITMAP_TYPE_PNG), "") # Open file tool fileBar.AddHybridButton( 103, "Save", wx.Bitmap("Icons/stock_save.png", wx.BITMAP_TYPE_PNG)) # Save file tool fileBar.AddHybridButton(104, "Print", wx.Bitmap("Icons/stock_print.png", wx.BITMAP_TYPE_PNG), "") # Print alignmentPanel = RB.RibbonPanel(home, -1, "Alignment") # Alignment menu alignBar = RB.RibbonButtonBar(alignmentPanel) alignBar.AddSimpleButton(105, "Left", wx.Bitmap("Icons/align_left.png", wx.BITMAP_TYPE_PNG), "") # Left Align alignBar.AddSimpleButton(106, "Center", wx.Bitmap("Icons/align_center.png", wx.BITMAP_TYPE_PNG), "") # Centre Align alignBar.AddSimpleButton(107, "Right", wx.Bitmap("Icons/align_right.png", wx.BITMAP_TYPE_PNG), "") # Right Align toolsPanel = RB.RibbonPanel(home, -1, "Text") # Text menu toolsBar = RB.RibbonButtonBar(toolsPanel) toolsBar.AddSimpleButton(108, "Standard", wx.Bitmap("Icons/bullet_point.png", wx.BITMAP_TYPE_PNG), "") # Standard Bullets toolsBar.AddSimpleButton(109, "Number", wx.Bitmap("Icons/numb_point.png", wx.BITMAP_TYPE_PNG), "") # Numbered Bullets toolsBar.AddSimpleButton(110, "Bold", wx.Bitmap("Icons/stock_text_bold.png", wx.BITMAP_TYPE_PNG), "") # Bold text toolsBar.AddSimpleButton(111, "Italic", wx.Bitmap("Icons/stock_text_italic.png", wx.BITMAP_TYPE_PNG), "") # Italic text toolsBar.AddSimpleButton(112, "Underline", wx.Bitmap("Icons/stock_text_underline.png", wx.BITMAP_TYPE_PNG), "") # Underline Text toolsBar.AddSimpleButton(119, "Highlight", wx.Bitmap("Icons/highlighter_icon.png", wx.BITMAP_TYPE_PNG), "") # Highlight text lineSpace = RB.RibbonPanel(home, -1, "Spacing") # Spacing menu lineBar = RB.RibbonButtonBar(lineSpace) lineBar.AddSimpleButton(113, "Normal", wx.Bitmap("Icons/spacing_normal.png", wx.BITMAP_TYPE_PNG), "") # Single line spacing lineBar.AddSimpleButton(114, "Half", wx.Bitmap("Icons/spacing_half.png", wx.BITMAP_TYPE_PNG), "") # 1 1/2 line spacing lineBar.AddSimpleButton(115, "Double", wx.Bitmap("Icons/spacing_double.png", wx.BITMAP_TYPE_PNG), "") # Double line spacing tabPanel = RB.RibbonPanel(home, -1, "Indent") # Indent menu tabBar = RB.RibbonButtonBar(tabPanel) tabBar.AddSimpleButton(116, "Right", wx.Bitmap("Icons/arrow_right.png", wx.BITMAP_TYPE_PNG), "") # Right indent tabBar.AddSimpleButton(117, "Left", wx.Bitmap("Icons/arrow_left.png", wx.BITMAP_TYPE_PNG), "") # Left indent picPanel = RB.RibbonPanel(home, -1, "Add Pictures") # Pictures menu picBar = RB.RibbonButtonBar(picPanel) picBar.AddSimpleButton(118, "Import", wx.Bitmap("Icons/insert_image.png", wx.BITMAP_TYPE_PNG), "") # Import pics ### ------------------------------------------- Font Tab: id = 200 -------------------------------------------- ### font_tab = RB.RibbonPage(self.ribbon, -1, "Font") # Font tab created fontPanel = RB.RibbonPanel(font_tab, 400, "Font") # Font gallery self.addColours(fontPanel, 200) fontPanel2 = RB.RibbonPanel(font_tab, -1, "Fonts") # Fonts bar fonts = RB.RibbonButtonBar(fontPanel2) fonts.AddSimpleButton( 201, "Font", wx.Bitmap("Icons/edit_pic.jpg", wx.BITMAP_TYPE_JPEG), "") fonts.AddSimpleButton( 202, "Words", wx.Bitmap("Icons/suggestion_icon.png", wx.BITMAP_TYPE_PNG), "") fonts.AddSimpleButton( 203, "Check", wx.Bitmap("Icons/suggestion_icon.png", wx.BITMAP_TYPE_PNG), "") fontPanel.Realize() fontPanel2.Realize() ### ------------------------------------------- End Ribbon ---------------------------------------------------- ### self.rtc = RichTextCtrl(self, style=wx.HSCROLL | wx.NO_BORDER) # Init rich text box wx.CallAfter(self.rtc.SetFocus) # Display text box self.rtc.BeginFont( wx.Font(15, wx.SWISS, wx.NORMAL, wx.NORMAL, False, "Calibri")) box = wx.BoxSizer( wx.VERTICAL) # Resizes widgets within window when resized box.Add(self.ribbon, 0, wx.EXPAND) # Resizes ribbon appropriately box.Add(self.rtc, 1, wx.EXPAND) # Fills in remaining space with text box self.ribbon.Realize() # Displays ribbon self.SetSizer(box) # Initiate self.Show(True) self.bindEvents()
def _init_ctrls(self, prnt): RB.RibbonBar.__init__(self, name='ribbon', parent=prnt, id=wxID_PANEL1) self.SetArtProvider(RB.RibbonAUIArtProvider()) self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) fileMenu = RB.RibbonPage(self, wxID_FileMenu, "File", wx.Bitmap(gui_utils.get_base_dir() + "\\3d_graph.png")) #----PlotMenu------------- home = RB.RibbonPage(self, wx.ID_ANY, "Plot", wx.Bitmap(gui_utils.get_base_dir() + "\\3d_graph.png")) #------Plot Type --------------------------------------------------------------------------- plot_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plots", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) plots_bar = RB.RibbonButtonBar(plot_panel, wx.ID_ANY) plots_bar.AddSimpleButton(wxID_RIBBONPLOTTIMESERIES, "Time Series", wx.Bitmap(gui_utils.get_base_dir() + "\\tsa_icon.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, "Probablity", wx.Bitmap(gui_utils.get_base_dir() + "\\probability.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, "Histogram", wx.Bitmap(gui_utils.get_base_dir() + "\\histogram.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, "Box/Whisker", wx.Bitmap(gui_utils.get_base_dir() + "\\box_whisker.png"), "") plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, "Summary", wx.Bitmap(gui_utils.get_base_dir() + "\\summary.png"), "") #-- PLOT OPTIONS----------------------------------------------------------------------------- PlotOptions_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plot Options", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.PlotsOptions_bar = RB.RibbonButtonBar(PlotOptions_panel, wx.ID_ANY) self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTTSTYPE, "Plot Type", wx.Bitmap(gui_utils.get_base_dir() + "\\plot_type.png"), "") self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSLEGEND, "Show Legend", wx.Bitmap(gui_utils.get_base_dir() + "\\legend.png"), help_string="show legend on plot", kind = 0x4) self.PlotsOptions_bar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "# Hist Bins", wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "") self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTDATESTART, False) self.spnBins = wx.SpinCtrl(id=wxID_FRAME1SPINCTRL1, initial=50, max=100, min=1, name='spnBins', parent=self.PlotsOptions_bar, pos= wx.Point(84,6), #without color button size=wx.Size(43, 25),style=wx.SP_ARROW_KEYS) self.spnBins.Enabled = False self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTBOXTYPE, "Box Whisker Type", wx.Bitmap(gui_utils.get_base_dir() + "\\box_whisker_type.png"), "") self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False) self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, False) self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBOXTYPE, False) dateTime_panel = RB.RibbonPanel(home, wx.ID_ANY, "Date Time", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) dateTime_buttonbar = RB.RibbonButtonBar(dateTime_panel) dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "") dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "") dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "") dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATESTART, False) self.dpStartDate = wx.DatePickerCtrl(id=wxID_STARTDPDATE, name=u'dpStartDate', parent=dateTime_buttonbar, pos=wx.Point(5, 8), size=wx.Size(120, 24), style=wx.DP_DROPDOWN) self.dpStartDate.SetValue(wx.DateTimeFromDMY(16, 1, 2008, 0, 0, 0)) self.dpStartDate.SetLabel(repr(wx.DateTimeFromDMY(16, 1, 2008, 0, 0, 0))) self.dpStartDate.SetToolTipString(u'Start Date') self.dpEndDate = wx.DatePickerCtrl(id=wxID_ENDDPDATE, name=u'dpEndDate', parent=dateTime_buttonbar, pos=wx.Point(5, 40), size=wx.Size(120, 24), style=wx.DP_DROPDOWN) self.dpEndDate.SetValue(wx.DateTimeFromDMY(01, 04, 2008, 0, 0, 0)) self.dpEndDate.SetLabel(repr(wx.DateTimeFromDMY(1, 04, 2008, 0, 0, 0))) self.dpEndDate.SetToolTipString(u'End Date') dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEREFRESH, "Refresh", wx.Bitmap(gui_utils.get_base_dir() + "\\date_setting.png"), "") dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEFULL, "Full Date Range", wx.Bitmap(gui_utils.get_base_dir() + "\\full_date_range.png"), "") #------------------------------------------------------------------------------- editPage = RB.RibbonPage(self, wx.ID_ANY, "Edit", wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png")) main_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Main", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.main_bar = RB.RibbonButtonBar(main_panel) self.main_bar.AddSimpleButton(wxID_RIBBONEDITSERIES, "Edit Series", bitmap=wx.Bitmap(gui_utils.get_base_dir() + "\\edit.png"), help_string="", kind = 0x4) self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, "Restore", wx.Bitmap(gui_utils.get_base_dir() + "\\restore.png"), "") self.main_bar.AddSimpleButton(wxID_RIBBONEDITSAVE, "Save", wx.Bitmap(gui_utils.get_base_dir() + "\\save_data.png"), "") self.main_bar.EnableButton(wxID_RIBBONEDITRESTORE, False) self.main_bar.EnableButton(wxID_RIBBONEDITSAVE, False) #------------------------------------------------------------------------------ edit_panel = RB.RibbonPanel( editPage, wx.ID_ANY, "Edit Functions" , wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.edit_bar= RB.RibbonButtonBar(edit_panel) self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFILTER, "Filter Points", wx.Bitmap(gui_utils.get_base_dir() + "\\filter_list.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITCHGVALUE, "Change Value", wx.Bitmap(gui_utils.get_base_dir() + "\\edit_view.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE, "Interpolate", wx.Bitmap(gui_utils.get_base_dir() + "\\interpolate.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, "Linear Drift", wx.Bitmap(gui_utils.get_base_dir() + "\\lin_drift.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, "Flag", wx.Bitmap(gui_utils.get_base_dir() + "\\flag.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, "Add Point", wx.Bitmap(gui_utils.get_base_dir() + "\\add.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, "Delete Point", wx.Bitmap(gui_utils.get_base_dir() + "\\delete.png"), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITRECORD, "Record", bitmap= wx.Bitmap(gui_utils.get_base_dir() + "\\record.png"), help_string="", kind = 0x4) self.edit_bar.EnableButton(wxID_RIBBONEDITFILTER, False) self.edit_bar.EnableButton(wxID_RIBBONEDITCHGVALUE, False) self.edit_bar.EnableButton(wxID_RIBBONEDITINTEROPOLATE, False) self.edit_bar.EnableButton(wxID_RIBBONEDITLINFILTER, False) self.edit_bar.EnableButton(wxID_RIBBONEDITFLAG, False) self.edit_bar.EnableButton(wxID_RIBBONEDITADDPOINT, False) self.edit_bar.EnableButton(wxID_RIBBONEDITDELPOINT, False) self.edit_bar.EnableButton(wxID_RIBBONEDITRECORD, False) #------------------------------------------------------------------------------- viewPage = RB.RibbonPage(self, wx.ID_ANY, "View", wx.Bitmap("images\\blank.png")) view_panel = RB.RibbonPanel( viewPage, wx.ID_ANY, "Tools" , wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) view_bar= RB.RibbonButtonBar(view_panel) view_bar.AddSimpleButton(wxID_RIBBONVIEWPLOT, "Plot", wx.Bitmap(gui_utils.get_base_dir() + "\\line_chart.png"), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, "Table", wx.Bitmap(gui_utils.get_base_dir() + "\\table.png"), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, "Series Selector", wx.Bitmap(gui_utils.get_base_dir() + "\\bitmap_editor.png"), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWCONSOLE, "Python Console", wx.Bitmap(gui_utils.get_base_dir() + "\\window_command_line.png"), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, "PythonScript", wx.Bitmap(gui_utils.get_base_dir() + "\\script.png"), "") self.CurrPage = 1 self.SetActivePageByIndex(self.CurrPage) self.BindEvents() Publisher.subscribe(self.toggleEditButtons, ("edit.EnableButtons"))
def _init_ctrls(self, prnt): RB.RibbonBar.__init__(self, name='ribbon', parent=prnt, id=wxID_PANEL1) # self.SetArtProvider(RB.RibbonMSWArtProvider()) self.SetArtProvider(RB.RibbonAUIArtProvider()) self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) fileMenu = RB.RibbonPage(self, wxID_FileMenu, "File") # ----PlotMenu------------- home = RB.RibbonPage(self, wx.ID_ANY, "Plot") # ------Plot Type --------------------------------------------------------------------------- plot_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plots", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.plots_bar = RB.RibbonButtonBar(plot_panel, wx.ID_ANY) self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTTIMESERIES, "Time Series", tsa_icon.GetBitmap(), "") self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, "Exceedance Frequency", probability.GetBitmap(), "") self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, "Histogram", histogram.GetBitmap(), "") self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, "Box/Whisker", box_whisker.GetBitmap(), "") self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, "Summary", summary.GetBitmap(), "") # -- PLOT OPTIONS----------------------------------------------------------------------------- PlotOptions_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plot Options", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.PlotsOptions_bar = RB.RibbonButtonBar(PlotOptions_panel, wx.ID_ANY) self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTTSTYPE, "Plot Type", plot_type.GetBitmap(), "") self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSLEGEND, "Show Legend", legend.GetBitmap(), help_string="show legend on plot", kind=0x4) self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "#Hist Bins", blank.GetBitmap(), "") self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBLANKBTN, False) self.spnBins = wx.SpinCtrl(id=wxID_FRAME1SPINCTRL1, initial=50, max=100, min=1, name='spnBins', parent=self.PlotsOptions_bar, pos=wx.Point(85, 7), # without color button size=wx.Size(44, 25), style=wx.SP_ARROW_KEYS) self.spnBins.Enabled = False self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTBOXTYPE, "Box Whisker Type", box_whisker_type.GetBitmap(), "") self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False) self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, False) self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBOXTYPE, False) dateTime_panel = RB.RibbonPanel(home, wx.ID_ANY, "Date Time", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.dateTime_buttonbar = RB.RibbonButtonBar(dateTime_panel) self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "", blank.GetBitmap(), "") self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "", blank.GetBitmap(), "") self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "", blank.GetBitmap(), "") self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTBLANKBTN, False) self.dpStartDate = wx.DatePickerCtrl(id=wxID_STARTDPDATE, name=u'dpStartDate', parent=self.dateTime_buttonbar, pos=wx.Point(5, 8), size=wx.Size(120, 24), style=wx.DP_DROPDOWN) self.dpStartDate.SetToolTipString(u'Start Date') self.dpEndDate = wx.DatePickerCtrl(id=wxID_ENDDPDATE, name=u'dpEndDate', parent=self.dateTime_buttonbar, pos=wx.Point(5, 40), size=wx.Size(120, 24), style=wx.DP_DROPDOWN) self.dpEndDate.SetToolTipString(u'End Date') self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEAPPLY, "Apply", date_setting.GetBitmap(), "") self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEFULL, "Full Date Range", full_date_range.GetBitmap(), "") self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATEFULL, False) self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATEAPPLY, False) self.dpEndDate.Enabled = False self.dpStartDate.Enabled = False # ------------------------------------------------------------------------------- editPage = RB.RibbonPage(self, wx.ID_ANY, "Edit") main_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Main", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.main_bar = RB.RibbonButtonBar(main_panel) self.editbutton = self.main_bar.AddSimpleButton(wxID_RIBBONEDITSERIES, "Edit Series", bitmap=edit.GetBitmap(), help_string="", kind=0x4) # kind sets the button to be a True or False self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, "Restore Series", restore.GetBitmap(), "") self.main_bar.AddSimpleButton(wxID_RIBBONEDITSAVE, "Save", save_data.GetBitmap(), "") self.main_bar.EnableButton(wxID_RIBBONEDITRESTORE, False) self.main_bar.EnableButton(wxID_RIBBONEDITSAVE, False) # ------------------------------------------------------------------------------ edit_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Edit Functions", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.edit_bar = RB.RibbonButtonBar(edit_panel) self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFILTER, "Filter Points", filter_list.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITRESETFILTER, "Reset Selection", Undo.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITCHGVALUE, "Change Value", edit_view.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE, "Interpolate", interpolate.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, "Linear Drift", lin_drift.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, "Flag", flag.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, "Add Point", add.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, "Delete Point", delete.GetBitmap(), "") self.edit_bar.AddSimpleButton(wxID_GAPFILL, "Fill Gap", magicwand.GetBitmap(), "") self.edit_bar.EnableButton(wxID_RIBBONEDITFILTER, False) self.edit_bar.EnableButton(wxID_RIBBONEDITCHGVALUE, False) self.edit_bar.EnableButton(wxID_RIBBONEDITRESETFILTER, False) self.edit_bar.EnableButton(wxID_RIBBONEDITINTEROPOLATE, False) self.edit_bar.EnableButton(wxID_RIBBONEDITLINFILTER, False) self.edit_bar.EnableButton(wxID_RIBBONEDITFLAG, False) self.edit_bar.EnableButton(wxID_RIBBONEDITADDPOINT, False) self.edit_bar.EnableButton(wxID_RIBBONEDITDELPOINT, False) self.edit_bar.EnableButton(wxID_GAPFILL, False) self.record_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Recording Options", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.record_bar = RB.RibbonButtonBar(self.record_panel) self.record_bar.AddSimpleButton(wxID_RIBBONRECORDNEW, "New Script", newscript.GetBitmap(), "") self.record_bar.AddSimpleButton(wxID_RIBBONRECORDOPEN, "Open Script", openscript.GetBitmap(), "") self.record_bar.AddSimpleButton(wxID_RIBBONRECORDSAVE, "Save Script", savescript.GetBitmap(), "") self.record_bar.EnableButton(wxID_RIBBONRECORDNEW, False) self.record_bar.EnableButton(wxID_RIBBONRECORDOPEN, False) self.record_bar.EnableButton(wxID_RIBBONRECORDSAVE, False) # ------------------------------------------------------------------------------- viewPage = RB.RibbonPage(self, wx.ID_ANY, "View") view_panel = RB.RibbonPanel(viewPage, wx.ID_ANY, "Tools", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) view_bar = RB.RibbonButtonBar(view_panel) view_bar.AddSimpleButton(wxID_RIBBONVIEWPLOT, "Plot", line_chart.GetBitmap(), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, "Table", table.GetBitmap(), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, "Series Selector", bitmap_editor.GetBitmap(), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWCONSOLE, "Python Console", window_command_line.GetBitmap(), "") view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, "PythonScript", script.GetBitmap(), "") self.scriptPanel = RB.RibbonPanel(viewPage, wx.ID_ANY, "Script Options", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE) self.scriptBar = RB.RibbonButtonBar(self.scriptPanel) self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDNEW, "New Script", newscript.GetBitmap(), "") self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDOPEN, "Open Script", openscript.GetBitmap(), "") self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDSAVE, "Save Script", savescript.GetBitmap(), "") self.scriptPanel.Hide() self.CurrPage = 1 self.SetActivePageByIndex(self.CurrPage) self.bindEvents() self.initPubSub()
def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, log=None): wx.Frame.__init__(self, parent, id, title, pos, size, wx.DEFAULT_FRAME_STYLE+wx.NO_BORDER+wx.CAPTION ) panel = wx.Panel(self) self._ribbon = RB.RibbonBar(panel, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) self._bitmap_creation_dc = wx.MemoryDC() self._colour_data = wx.ColourData() home = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Examples", CreateBitmap("ribbon")) toolbar_panel = mini_toolbar(home) # selection_panel = mini_selection(home) # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # # selection_panel = RB.RibbonPanel(home, wx.ID_ANY, "Selection", CreateBitmap("selection_panel")) selection = RB.RibbonButtonBar(selection_panel) selection.AddSimpleButton(ID_SELECTION_EXPAND_V, "Expand Vertically", CreateBitmap("expand_selection_v"), "This is a tooltip for Expand Vertically\ndemonstrating a tooltip") selection.AddSimpleButton(ID_SELECTION_EXPAND_H, "Expand Horizontally", CreateBitmap("expand_selection_h"), "") selection.AddButton(ID_SELECTION_CONTRACT, "Contract", CreateBitmap("auto_crop_selection"), CreateBitmap("auto_crop_selection_small")) # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # # shapes_panel = RB.RibbonPanel(home, wx.ID_ANY, "Shapes", CreateBitmap("circle_small")) shapes = RB.RibbonButtonBar(shapes_panel) shapes.AddButton(ID_CIRCLE, "Circle", CreateBitmap("circle"), CreateBitmap("circle_small"), help_string="This is a tooltip for the circle button\ndemonstrating another tooltip", kind=RB.RIBBON_BUTTON_TOGGLE) shapes.AddSimpleButton(ID_CROSS, "Cross", CreateBitmap("cross"), "") shapes.AddHybridButton(ID_TRIANGLE, "Triangle", CreateBitmap("triangle")) shapes.AddSimpleButton(ID_SQUARE, "Square", CreateBitmap("square"), "") shapes.AddDropdownButton(ID_POLYGON, "Other Polygon", CreateBitmap("hexagon"), "") # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # # sizer_panel = RB.RibbonPanel(home, wx.ID_ANY, "Panel with Sizer", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_DEFAULT_STYLE) strs = ["Item 1 using a box sizer now", "Item 2 using a box sizer now"] sizer_panelcombo = wx.ComboBox(sizer_panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, strs, wx.CB_READONLY) sizer_panelcombo2 = wx.ComboBox(sizer_panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, strs, wx.CB_READONLY) sizer_panelcombo.Select(0) sizer_panelcombo2.Select(1) sizer_panelcombo.SetMinSize(wx.Size(150, -1)) sizer_panelcombo2.SetMinSize(wx.Size(150, -1)) # not using wx.WrapSizer(wx.HORIZONTAL) as it reports an incorrect min height sizer_panelsizer = wx.BoxSizer(wx.VERTICAL) sizer_panelsizer.AddStretchSpacer(1) sizer_panelsizer.Add(sizer_panelcombo, 0, wx.ALL|wx.EXPAND, 2) sizer_panelsizer.Add(sizer_panelcombo2, 0, wx.ALL|wx.EXPAND, 2) sizer_panelsizer.AddStretchSpacer(1) sizer_panel.SetSizer(sizer_panelsizer) # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # # label_font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT) self._bitmap_creation_dc.SetFont(label_font) scheme = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Appearance", CreateBitmap("eye")) self._default_primary, self._default_secondary, self._default_tertiary = self._ribbon.GetArtProvider().GetColourScheme(1, 1, 1) provider_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Art", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) provider_bar = RB.RibbonButtonBar(provider_panel, wx.ID_ANY) provider_bar.AddSimpleButton(ID_DEFAULT_PROVIDER, "Default Provider", wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(32, 32)), "") provider_bar.AddSimpleButton(ID_AUI_PROVIDER, "AUI Provider", CreateBitmap("aui_style"), "") provider_bar.AddSimpleButton(ID_MSW_PROVIDER, "MSW Provider", CreateBitmap("msw_style"), "") primary_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Primary Colour", CreateBitmap("colours")) self._primary_gallery = self.PopulateColoursPanel(primary_panel, self._default_primary, ID_PRIMARY_COLOUR) secondary_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Secondary Colour", CreateBitmap("colours")) self._secondary_gallery = self.PopulateColoursPanel(secondary_panel, self._default_secondary, ID_SECONDARY_COLOUR) dummy_2 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Empty Page", CreateBitmap("empty")) dummy_3 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Another Page", CreateBitmap("empty")) self._ribbon.Realize() self._logwindow = wx.TextCtrl(panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LEFT | wx.TE_BESTWRAP | wx.BORDER_NONE) self._togglePanels = wx.ToggleButton(panel, ID_TOGGLE_PANELS, "&Toggle panels") self._togglePanels.SetValue(True) s = wx.BoxSizer(wx.VERTICAL) s.Add(self._ribbon, 0, wx.EXPAND) s.Add(self._logwindow, 1, wx.EXPAND) s.Add(self._togglePanels, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 10) panel.SetSizer(s) self.panel = panel self.BindEvents([selection, shapes, provider_bar, toolbar_panel]) self.SetIcon(images.Mondrian.Icon) self.CenterOnScreen() self.Show()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Geochemical QAQC Program", pos=wx.DefaultPosition, size=wx.Size(700, 700), style=wx.DEFAULT_FRAME_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) box = wx.BoxSizer(wx.VERTICAL) open_Proj = wx.Window.NewControlId() save_Proj = wx.Window.NewControlId() exp_Rep = wx.Window.NewControlId() std_db = wx.Window.NewControlId() open_Setting = wx.Window.NewControlId() exit_bot = wx.Window.NewControlId() self.rb = rb.RibbonBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_BAR_DEFAULT_STYLE) self.Page1 = rb.RibbonPage(self.rb, wx.ID_ANY, u"MyRibbonPage", wx.NullBitmap, 0) self.file_panel = rb.RibbonPanel( self.Page1, wx.ID_ANY, wx.EmptyString, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_PANEL_DEFAULT_STYLE) self.rbb1 = rb.RibbonButtonBar(self.file_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.rbb1.AddSimpleButton( open_Proj, u"Open Project", wx.Bitmap(u"img/open_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rbb1.AddSimpleButton( save_Proj, u"Save Project", wx.Bitmap(u"img/save_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rbb1.AddSimpleButton( exp_Rep, u"Print Report", wx.Bitmap(u"img/report_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.db_panel = rb.RibbonPanel( self.Page1, wx.ID_ANY, wx.EmptyString, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_PANEL_DEFAULT_STYLE) self.rbb2 = rb.RibbonButtonBar(self.db_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.rbb2.AddSimpleButton( std_db, u"Standard Database", wx.Bitmap(u"img/database_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.exit_panel = rb.RibbonPanel( self.Page1, wx.ID_ANY, wx.EmptyString, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_PANEL_DEFAULT_STYLE) self.rbb3 = rb.RibbonButtonBar(self.exit_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.rbb3.AddSimpleButton( open_Setting, u" Settings", wx.Bitmap(u"img/set_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rbb3.AddSimpleButton( exit_bot, u" Exit", wx.Bitmap(u"img/exit_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rb.Realize() #Set buttom event in the Ribbon buttons self.rbb1.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.openProject, id=open_Proj) self.rbb1.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.SaveProject, id=save_Proj) self.rbb1.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.ExportReport, id=exp_Rep) self.rbb2.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.StandardDB, id=std_db) self.rbb3.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.open_Setting, None, id=open_Setting) self.rbb3.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.Onclose, None, id=exit_bot) box.Add(self.rb, 0, wx.ALL | wx.EXPAND, 5) self.note = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.data_panel = wx.Panel(self.note, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, -1), 0) box1 = wx.BoxSizer(wx.HORIZONTAL) self.Datagrid = wx.grid.Grid(self.data_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) # Grid self.Datagrid.CreateGrid(100, 4) self.Datagrid.EnableEditing(True) self.Datagrid.EnableGridLines(True) self.Datagrid.EnableDragGridSize(False) self.Datagrid.SetMargins(50, 0) # Columns self.Datagrid.SetColSize(0, 100) self.Datagrid.SetColSize(1, 100) self.Datagrid.SetColSize(2, 100) self.Datagrid.SetColSize(3, 100) self.Datagrid.EnableDragColMove(False) self.Datagrid.EnableDragColSize(True) self.Datagrid.SetColLabelSize(30) self.Datagrid.SetColLabelValue(0, u"Sample ID") self.Datagrid.SetColLabelValue(1, u"Sample Type") self.Datagrid.SetColLabelValue(2, u"Duplicate") self.Datagrid.SetColLabelValue(3, u"Assay 01") #self.Datagrid.SetColLabelValue( 4, u"Assay 02" ) #self.Datagrid.SetColLabelValue( 5, u"Assay 03" ) self.Datagrid.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) # Rows self.Datagrid.EnableDragRowSize(True) self.Datagrid.SetRowLabelSize(50) self.Datagrid.SetRowLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) # Label Appearance # Cell Defaults self.Datagrid.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_TOP) box1.Add(self.Datagrid, 0, wx.ALL, 5) box2 = wx.BoxSizer(wx.VERTICAL) box2.Add((0, 0), 1, wx.EXPAND, 5) self.m_staticText2 = wx.StaticText(self.data_panel, wx.ID_ANY, u"Open Data File ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText2.Wrap(-1) box2.Add(self.m_staticText2, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.open_file = wx.BitmapButton(self.data_panel, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW | 0) self.open_file.SetBitmap( wx.Bitmap(u"img/opendata_47.png", wx.BITMAP_TYPE_ANY)) box2.Add(self.open_file, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #Set open file data function self.open_file.Bind(wx.EVT_BUTTON, self.LoadData) box2.Add((0, 0), 1, 0, 5) self.m_staticText2 = wx.StaticText(self.data_panel, wx.ID_ANY, u"Clear Data ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText2.Wrap(-1) box2.Add(self.m_staticText2, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.clear_datagrid = wx.BitmapButton(self.data_panel, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW | 0) self.clear_datagrid.SetBitmap( wx.Bitmap(u"img/trash_47.png", wx.BITMAP_TYPE_ANY)) box2.Add(self.clear_datagrid, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #Set open file data function self.clear_datagrid.Bind(wx.EVT_BUTTON, self.clear_DataGrid) box2.Add((0, 0), 1, 0, 5) self.m_sline = wx.StaticLine(self.data_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) box2.Add(self.m_sline, 0, wx.EXPAND | wx.ALL, 5) #set the Technical Manager self.m_st_technicalman = wx.StaticText(self.data_panel, wx.ID_ANY, u"Technical Manager:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_st_technicalman.Wrap(-1) box2.Add(self.m_st_technicalman, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_Tech = wx.TextCtrl(self.data_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) box2.Add(self.m_Tech, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #set the Batch name self.m_st_batch = wx.StaticText(self.data_panel, wx.ID_ANY, u"Batch Name:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_st_batch.Wrap(-1) box2.Add(self.m_st_batch, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_Bath = wx.TextCtrl(self.data_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) box2.Add(self.m_Bath, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_staticText3 = wx.StaticText(self.data_panel, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText3.Wrap(-1) box2.Add(self.m_staticText3, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.run_bot = wx.BitmapButton(self.data_panel, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW | 0) self.run_bot.SetBitmap(wx.Bitmap(u"img/run_47.png", wx.BITMAP_TYPE_ANY)) box2.Add(self.run_bot, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #Set open file data function self.run_bot.Bind(wx.EVT_BUTTON, self.runProject) box2.Add((0, 0), 1, wx.EXPAND, 5) box1.Add(box2, 1, wx.EXPAND, 5) self.data_panel.SetSizer(box1) self.data_panel.Layout() box1.Fit(self.data_panel) self.note.AddPage(self.data_panel, u"DATA", True) #Set the report panel self.report_panel = wx.Panel(self.note, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) gs_report = wx.BoxSizer(wx.VERTICAL) self.buttonpanel = pdfButtonPanel(self.report_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.pdfViewer = pdfViewer(self.report_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL | wx.VSCROLL | wx.SUNKEN_BORDER) self.pdfViewer.UsePrintDirect = "False" # introduce buttonpanel and viewer to each other self.buttonpanel.viewer = self.pdfViewer self.pdfViewer.buttonpanel = self.buttonpanel #add the buutonpanel and pdfviewer to boxsizer gs_report.Add(self.buttonpanel, 1, wx.ALL, 5) gs_report.Add(self.pdfViewer, 100, wx.EXPAND | wx.ALL, 5) self.report_panel.SetSizer(gs_report) self.report_panel.Layout() gs_report.Fit(self.report_panel) self.note.AddPage(self.report_panel, u"Report", False) box.Add(self.note, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(box) self.Layout() self.Centre(wx.BOTH) #set the types self.type = ["SMP", "BLANK", "DUP"] #Load std for list self.Load_STD() #set the setting parameters self.Get_setting() #clear temporary files self.Clear_tempFiles() #set Datagrid cell Editor for fill with list self.type_editor = wx.grid.GridCellChoiceEditor(self.type, True) #set the editor cell for i in range(0, 100): self.Datagrid.SetCellEditor(i, 1, self.type_editor)