def __init__(self, parent, init=False): self.parent = parent self.initialized = False self.root = None self._resources = xrc.EmptyXmlResource() self._resources.Load(_getpath('xrc', 'configure.xrc')) pre = wx.PrePanel() self.PreCreate(pre) self._resources.LoadOnPanel(pre, parent, "configure_panel") self.PostCreate(pre) self.pg = wxpg.PropertyGridManager(self, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) self.pg_ctrl = self._resources.AttachUnknownControl( "property_grid", self.pg, self) xrc.XRCCTRL(self, 'generate_b').Bind(wx.EVT_BUTTON, self.onGenerate) xrc.XRCCTRL(self, 'reset_b').Bind(wx.EVT_BUTTON, self.onReset) xrc.XRCCTRL(self, 'load_b').Bind(wx.EVT_BUTTON, self.onLoad) xrc.XRCCTRL(self, 'save_b').Bind(wx.EVT_BUTTON, self.onSave) if init: wx.CallAfter(self.collect)
def initEditor(self): #draw_button = wx.Button(self, label="Press Me") #self.Bind(wx.EVT_BUTTON, self.OnButtonPressed, draw_button) mb = self.MakeMenuBar() self.SetMenuBar(mb) self.CreateStatusBar() self.Maximize(True) self.Centre() self.Show() self.bSizer1 = wx.BoxSizer(wx.HORIZONTAL) self.m_auinotebook1 = wx.aui.AuiNotebook(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(550, -1), wx.aui.AUI_NB_DEFAULT_STYLE) self.bSizer1.Add(self.m_auinotebook1, 1, wx.EXPAND | wx.ALL, 5) bSizer2 = wx.BoxSizer(wx.VERTICAL) self.m_dataViewCtrl1 = wx.dataview.DataViewCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.Size(130, 200), 0) bSizer2.Add(self.m_dataViewCtrl1, 0, wx.ALL, 5) self.m_propertyGridManager1 = pg.PropertyGridManager( self, wx.ID_ANY, wx.DefaultPosition, wx.Size(130, 200), wx.propgrid.PGMAN_DEFAULT_STYLE) self.m_propertyGridManager1.SetExtraStyle( wx.propgrid.PG_EX_MODE_BUTTONS) self.m_propertyGridPage1 = self.m_propertyGridManager1.AddPage( u"Page", wx.NullBitmap) self.m_propertyGridItem1 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name", u"Name")) self.m_propertyGridItem6 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name1", u"Name1")) self.m_propertyGridItem7 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name2", u"Name2")) self.m_propertyGridItem8 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name3", u"Name3")) self.m_propertyGridItem9 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name4", u"Name4")) self.m_propertyGridItem2 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name5", u"Name5")) self.m_propertyGridItem3 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name6", u"Name6")) self.m_propertyGridItem4 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name7", u"Name7")) self.m_propertyGridItem5 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name8", u"Name8")) bSizer2.Add(self.m_propertyGridManager1, 0, wx.ALL, 5) self.bSizer1.Add(bSizer2, 1, wx.EXPAND, 5) self.SetSizer(self.bSizer1) self.Layout() self.Centre(wx.BOTH)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL, name=wx.EmptyString): wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) bSizer1 = wx.BoxSizer(wx.HORIZONTAL) self.app = wx.GetApp() self.lstPrefPages = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_ALIGN_TOP | wx.LC_ICON | wx.LC_SINGLE_SEL) bSizer1.Add(self.lstPrefPages, 0, wx.BOTTOM | wx.EXPAND | wx.LEFT | wx.TOP, 5) prefsImageSize = wx.Size(48, 48) self.prefsIndex = 0 self.prefsImages = wx.ImageList(prefsImageSize.GetWidth(), prefsImageSize.GetHeight()) self.lstPrefPages.AssignImageList(self.prefsImages, wx.IMAGE_LIST_NORMAL) self.proPrefs = pg.PropertyGridManager( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.propgrid.PGMAN_DEFAULT_STYLE | wx.propgrid.PG_BOLD_MODIFIED | wx.propgrid.PG_DESCRIPTION | wx.TAB_TRAVERSAL) self.proPrefs.SetExtraStyle(wx.propgrid.PG_EX_MODE_BUTTONS) bSizer1.Add(self.proPrefs, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(bSizer1) self.Layout() # Connect Events self.lstPrefPages.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnPrefPageDeselected) self.lstPrefPages.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnPrefPageSelected) self.proPrefs.Bind(pg.EVT_PG_CHANGED, self.OnPropPageChanged) self.proPrefs.Bind(pg.EVT_PG_CHANGING, self.OnPropPageChanging) # categories and their items are stored here self.sections = collections.OrderedDict() # pages in the property manager self.pages = dict() self.pageNames = dict() # help text self.helpText = dict() self.pageIdx = 0
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'NLExtract BAG config aanpassen', size=(400, 200)) self.panel = panel = wx.Panel(self, wx.ID_ANY) # Difference between using PropertyGridManager vs PropertyGrid is that # the manager supports multiple pages and a description box. self.pg = pg = wxpg.PropertyGridManager( panel, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT) pg.AddPage("BAG Extract Config") pg.Append(wxpg.PropertyCategory("BAG Extract Config")) pg.Append( wxpg.StringProperty("Database naam", value="%s" % BAGConfig.config.database)) pg.Append( wxpg.StringProperty("Database schema", value="%s" % BAGConfig.config.schema)) pg.Append( wxpg.StringProperty("Database host", value="%s" % BAGConfig.config.host)) pg.Append( wxpg.StringProperty("Database user", value="%s" % BAGConfig.config.user)) pg.Append( wxpg.StringProperty("Database password", value="%s" % BAGConfig.config.password)) pg.Append( wxpg.IntProperty("Database poort", value=int(BAGConfig.config.port))) # pg.Append(wxpg.BoolProperty("Verbose logging", value=True)) # pg.SetPropertyAttribute("Bool_with_Checkbox", "UseCheckbox", True) topsizer = wx.BoxSizer(wx.VERTICAL) topsizer.Add(pg, 1, wx.EXPAND) but = wx.Button(panel, -1, "Bewaren") but.Bind(wx.EVT_BUTTON, self.OnSave) topsizer.Add(but, 1, wx.EXPAND) # rowsizer = wx.BoxSizer(wx.HORIZONTAL) # rowsizer.Add(but, 1) panel.SetSizer(topsizer) topsizer.SetSizeHints(panel) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel, 1, wx.EXPAND) self.SetSizer(sizer) self.SetAutoLayout(True)
def CreateGUI(self): # use this object for lookup table info self.LD = data.LutData() # propgrid self.sizer = wx.BoxSizer(wx.VERTICAL) self._Dialog.SetSizer(self.sizer) self._pg = wxpg.PropertyGridManager(self._Dialog, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) self._pg.RegisterAdditionalEditors() if ImageInfo.initialized == 0: self._pg.RegisterEditor(BackgroundColourEditor) ImageInfo.initialized = True self._general_page = self._pg.AddPage("General Properties") self._dicom_page = self._pg.AddPage( "DICOM Tag Info", bmp=self._stockicons.getToolbarBitmap("dicom_button")) # add an anonymize button toolbar = self._pg.GetToolBar() toolbar.AddSeparator() toolId = wx.NewId() anon_bitmap = self._stockicons.getToolbarBitmap("anonymize") anon_tool = toolbar.AddLabelTool(toolId, "Anonymize", anon_bitmap, shortHelp="Anonymize Image", longHelp="Anonymize Image") toolbar.Realize() self.sizer.Add(self._pg, 1, wx.EXPAND) self._pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropertyChange) self._pg.Bind(wx.EVT_TOOL, self.onAnonymizeButton, anon_tool) # search button self.m_searchCtrl = wx.SearchCtrl(self._Dialog, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER) self.m_searchCtrl.ShowSearchButton(True) self.m_searchCtrl.ShowCancelButton(True) self.sizer.Add(self.m_searchCtrl, 0, wx.BOTTOM | wx.EXPAND, 5) # Connect Events self.m_searchCtrl.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.onSearchCancel) self.m_searchCtrl.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.onSearch) self.m_searchCtrl.Bind(wx.EVT_TEXT_ENTER, self.onSearch)
def __init__(self, parent): wx.Panel.__init__(self, parent) self.pg = wxpg.PropertyGridManager(self, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) self.pg.AddPage("Properties") self.pg.Append(wxpg.PropertyCategory("Basic")) self.pg.Append(wxpg.StringProperty("Name", value="Lead")) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.pg, 1, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, size=wx.Size(200, 150)) self._pgm = wxpg.PropertyGridManager( self, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_BOLD_MODIFIED | wxpg.PG_HIDE_CATEGORIES | wxpg.PG_NO_INTERNAL_BORDER | wxpg.PG_TOOLBAR | wxpg.PG_HIDE_MARGIN) self._pgm.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) self._pgm.GetGrid().SetSplitterLeft() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self._pgm, 1, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, parent, id, *args, **kwargs): wx.Panel.__init__(self, parent, id) self.prop_names = [] setting = kwargs.pop("setting", {}) sizer1 = wx.BoxSizer(wx.HORIZONTAL) sizer2 = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer1) sizer1.Add(sizer2, 1, wx.EXPAND) self.pg = wxpg.PropertyGridManager( self, style=wxpg.PG_SPLITTER_AUTO_CENTER | #wxpg.PG_AUTO_SORT| #wxpg.PG_DESCRIPTION | wxpg.PG_TOOLBAR) self.pg.AddPage("Serial", bmp=bmp1) self.pg.SelectPage(0) self.pg.SetColumnCount(2) self.pg.SetColumnTitle(0, "FES var.") self.pg.Append(SmootherChoiceProperty("E1", choices=SparseSmoother)) self.pg.AddPage("Parallel", bmp=bmp2) self.pg.SelectPage(1) self.pg.SetColumnCount(2) self.pg.SetColumnTitle(0, "FES var.") self.pg.Append(SmootherChoiceProperty("E1", choices=HypreSmoother)) self.pg.SetPageSplitterPosition(0, 0.5) self.pg.SetPageSplitterPosition(1, 0.5) self.pg.ShowHeader(True) sizer2.Add(self.pg, 1, wx.EXPAND | wx.ALL, 1) self.pg.Bind(wxpg.EVT_PG_PAGE_CHANGED, self.OnPropGridPageChange) self.pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange) value = [( 'E1', ['GS', 'GS'], ), ('V1', ['GS', 'Jacobi'])] self.SetValue(value)
def __init__( self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY) # Controls self.txt = wx.StaticText(self,-1,"") self.panel = wx.Panel(self,-1) self.pg = wxpg.PropertyGridManager(self.panel, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT ) self.but = wx.Button(self.panel,-1,"show") # DATA self.__modelSel = None # CFG self.but.Bind( wx.EVT_BUTTON, self.updateFigure ) self.pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) self.setProperties()
def __init__(self,mainframe,target=None,startOldFile=False): wx.Frame.__init__(self, mainframe, -1, "New Template.tmpl*", style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ) self.Size=wx.Size(900,600) self.changed=False self.saved=False self.file='' self.dir='.' self.pycrust=None #Save the treectrlitem we have to change once the windows is closed or the template is save self.TemplateTreeItem=target if mainframe: self.dir=mainframe.deckdir self.statusbar=wx.StatusBar(self) self.SetStatusBar(self.statusbar) #Create Tree self.tree=wx.TreeCtrl(self,-1,size=(250,100),style=wx.TR_LINES_AT_ROOT|wx.TR_DEFAULT_STYLE|wx.TR_HAS_BUTTONS) self.tree.Bind(wx.EVT_TREE_SEL_CHANGED,self.OnTreeSelectionChanged) self.propgrid= wxpg.PropertyGridManager(self, style= wxpg.PG_SPLITTER_AUTO_CENTER |wxpg.PG_EX_HELP_AS_TOOLTIPS| wxpg.PG_TOOLBAR) self.propgrid.Bind( wxpg.EVT_PG_CHANGED, self.OnPropGridChange) #from deckmvc import MSEGrid #self.deckgrid=MSEGrid(self) self.CreateImageList() self.tree.SetImageList(self.il) self.CreateToolbar() from oglwin import TW self._thewin=TW(self) #keep the elts details self.CreateTree() self.CreateBlankTemplate() #Evt management #####self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyDown) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) #Sizing self._init_aui() #dND self.SetDropTarget(MyFileDropTarget(self)) #Open Last opened file if startOldFile: import os.path if os.path.isfile('designer_last_file'): dst=file('designer_last_file','rb').read() if os.path.isfile(dst): self.LoadTemplate(dst)
def init_view(self, items, para, preview=False, modal=True, app=None): self.para, self.modal = para, modal self.pg = pg = wxpg.PropertyGridManager( self, style=wxpg.PG_SPLITTER_AUTO_CENTER) sizer = wx.BoxSizer(wx.VERTICAL) # Show help as tooltips pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange) pg.Bind(wxpg.EVT_PG_SELECTED, self.OnPropGridSelect) pg.AddPage('') for i in items: if i[0] == 'lab': pg.Append(wxpg.PropertyCategory(i[2])) if i[0] == int: pg.Append(wxpg.IntProperty(i[1], value=int(para[i[1]]) or 0)) if i[0] == float: pg.Append( wxpg.FloatProperty(i[1], value=float(para[i[1]]) or 0)) if i[0] == str: pg.Append(wxpg.StringProperty(i[1], value=para[i[1]] or '')) if i[0] == 'txt': pg.Append(wxpg.LongStringProperty(i[1], value=para[i[1]] or '')) if i[0] == bool: pg.Append(wxpg.BoolProperty(i[1])) if i[0] == 'date': pg.Append(wxpg.DateProperty(i[1], value=wx.DateTime.Now())) #if i[0] == 'list': pg.Append( wxpg.EnumProperty(i[1], i[1], [i.strip() for i in i[2][1:-1].split(',')])) #if i[0] == 'img': pg.Append( wxpg.EnumProperty(v[1], v[1], ['a','b','c'])) #if i[0] == 'tab': pg.Append( wxpg.EnumProperty(v[1], v[1], ['a','b','c'])) #if preview:self.add_ctrl_(Check, 'preview', ('preview',), app=app) #self.reset(para) sizer.Add(pg, 1, wx.EXPAND) self.SetSizer(sizer) self.add_confirm(modal) self.Layout() self.Fit() wx.Dialog.Bind(self, wx.EVT_WINDOW_DESTROY, self.OnDestroy) #wx.Dialog.Bind(self, wx.EVT_IDLE, lambda e: self.reset()) print('bind close')
def __init__( self, parent, edit_callback ): wx.Panel.__init__(self, parent, wx.ID_ANY) self.edit_callback = edit_callback self.panel = panel = wx.Panel(self, wx.ID_ANY) topsizer = wx.BoxSizer(wx.VERTICAL) # Difference between using PropertyGridManager vs PropertyGrid is that # the manager supports multiple pages and a description box. self.pg = pg = wxpg.PropertyGridManager(panel, style=wxpg.PG_SPLITTER_AUTO_CENTER | # wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) pg.RegisterEditor(ButtonEditor) ButtonEditor.edit_callback = edit_callback self.page = None self.child_page = None self.current_page = None # Show help as tooltips # pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) pg.Bind( wxpg.EVT_PG_CHANGED, self.OnPropGridChange ) # pg.Bind( wxpg.EVT_PG_PAGE_CHANGED, self.OnPropGridPageChange ) # pg.Bind( wxpg.EVT_PG_SELECTED, self.OnPropGridSelect ) # pg.Bind( wxpg.EVT_PG_RIGHT_CLICK, self.OnPropGridRightClick ) # self.pg.AddPage( "Particle" ) # self.init_prop() topsizer.Add(pg, 1, wx.EXPAND) panel.SetSizer(topsizer) topsizer.SetSizeHints(panel) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel, 1, wx.EXPAND) self.SetSizer(sizer) self.SetAutoLayout(True)
def __init__( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,395 ), style = wx.TAB_TRAVERSAL, name = wx.EmptyString ): wx.Panel.__init__ ( self, parent, id = id, pos = pos, size = size, style = style, name = name ) bSizer1 = wx.BoxSizer( wx.VERTICAL ) self.m_propertyGridManager1 = pg.PropertyGridManager(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.propgrid.PG_DESCRIPTION|wx.propgrid.PG_SPLITTER_AUTO_CENTER|wx.propgrid.PG_TOOLBAR|wx.propgrid.PG_TOOLTIPS|wx.TAB_TRAVERSAL) self.m_propertyGridManager1.SetExtraStyle( wx.propgrid.PG_EX_AUTO_UNSPECIFIED_VALUES|wx.propgrid.PG_EX_MODE_BUTTONS|wx.propgrid.PG_EX_NO_FLAT_TOOLBAR|wx.propgrid.PG_EX_NO_TOOLBAR_DIVIDER ) self.m_propertyGridPage1 = self.m_propertyGridManager1.AddPage( u"Page", wx.ArtProvider.GetBitmap( wx.ART_REPORT_VIEW, wx.ART_BUTTON ) ); self.Item1 = self.m_propertyGridPage1.Append( pg.PropertyCategory( u"Directory of Work", u"Directory of Work" ) ) self.Item2 = self.m_propertyGridPage1.Append( pg.DirProperty( u"Database and Sql files", u"Database and Sql files" ) ) self.Item3 = self.m_propertyGridPage1.Append( pg.DirProperty( u"Utility and Plugin", u"Utility and Plugin" ) ) self.Item4 = self.m_propertyGridPage1.Append( pg.DirProperty( u"Server and Local Network", u"Server and Local Network" ) ) self.m_propertyGridPage1.SetPropertyHelpString( Item4, u"Directory of Local Network that Database and Main File here and other client get Data from it" ) self.Item5 = self.m_propertyGridPage1.Append( pg.DirProperty( u"Other and Temp", u"Other and Temp" ) ) self.Item6 = self.m_propertyGridPage1.Append( pg.PropertyCategory( u"General parameter", u"General parameter" ) ) self.Item7 = self.m_propertyGridPage1.Append( pg.DateProperty( u"Date of Today ", u"Date of Today " ) ) self.Item8 = self.m_propertyGridPage1.Append( pg.EnumProperty( u"Language", u"Language" ) ) self.Item9 = self.m_propertyGridPage1.Append( pg.BoolProperty( u"Show Clock", u"Show Clock" ) ) self.Item10 = self.m_propertyGridPage1.Append( pg.FontProperty( u"Font", u"Font" ) ) self.Item11 = self.m_propertyGridPage1.Append( pg.FlagsProperty( u"Size", u"Size" ) ) self.Item12 = self.m_propertyGridPage1.Append( pg.StringProperty( u"position", u"position" ) ) self.m_propertyGridPage2 = self.m_propertyGridManager1.AddPage( u"Page", wx.ArtProvider.GetBitmap( wx.ART_LIST_VIEW, wx.ART_TOOLBAR ) ); self.Item13 = self.m_propertyGridPage2.Append( pg.PropertyCategory( u"Other Status", u"Other Status" ) ) self.Item14 = self.m_propertyGridPage2.Append( pg.StringProperty( u"Toolbar", u"Toolbar" ) ) self.Item15 = self.m_propertyGridPage2.Append( pg.StringProperty( u"Pan Input", u"Pan Input" ) ) self.Item16 = self.m_propertyGridPage2.Append( pg.StringProperty( u"Pan Status", u"Pan Status" ) ) self.Item17 = self.m_propertyGridPage2.Append( pg.ImageFileProperty( u"Background", u"Background" ) ) self.Item18 = self.m_propertyGridPage2.Append( pg.CursorProperty( u"Cursor", u"Cursor" ) ) self.Item19 = self.m_propertyGridPage2.Append( pg.LongStringProperty( u"Help", u"Help" ) ) bSizer1.Add( self.m_propertyGridManager1, 1, wx.ALL|wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout()
def test_propgridmanager02(self): mgr = pg.PropertyGridManager(self.frame) page1 = mgr.AddPage('label')
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=_(u"Resource editor"), pos=wx.Point(0, 0), size=wx.Size(447, 765), style=wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER | wx.STAY_ON_TOP | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.editor_toolBar = wx.ToolBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL) self.new_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"New resource"), _(u"New resource"), None) self.open_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Open resource"), _(u"Open resource"), None) self.save_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Save resource"), _(u"Save resource"), None) self.saveas_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Save as ..."), _(u"Save as ..."), None) self.editor_toolBar.AddSeparator() self.test_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_GO_FORWARD, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Test"), _(u"Test"), None) self.editor_toolBar.AddSeparator() self.design_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(u"gtk-preferences", wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Design"), _(u"Design"), None) self.editor_toolBar.AddSeparator() self.module_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(u"gtk-select-all", wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Generate resource module"), _(u"Generate resource module"), None) self.editor_toolBar.AddSeparator() self.help_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Help ..."), _(u"Help ..."), None) self.editor_toolBar.AddSeparator() self.collapse_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Hide object inspector"), _(u"Hide object inspector"), None) self.expand_tool = self.editor_toolBar.AddTool( wx.ID_ANY, _(u"tool"), wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_MENU), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Show object inspector"), _(u"Show object inspector"), None) self.editor_toolBar.Realize() bSizer1.Add(self.editor_toolBar, 0, wx.EXPAND, 5) self.editor_splitter = wx.SplitterWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D) self.editor_splitter.Bind(wx.EVT_IDLE, self.editor_splitterOnIdle) self.resource_panel = wx.Panel(self.editor_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer2 = wx.BoxSizer(wx.VERTICAL) self.resource_treeListCtrl = wx.lib.gizmos.TreeListCtrl( self.resource_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.dataview.TL_DEFAULT_STYLE | wx.dataview.TL_SINGLE) self.resource_treeListCtrl.AddColumn(_(u"Name"), 300, wx.ALIGN_LEFT) self.resource_treeListCtrl.AddColumn(_(u"Description"), 300, wx.ALIGN_LEFT) bSizer2.Add(self.resource_treeListCtrl, 1, wx.EXPAND | wx.ALL, 5) self.resource_panel.SetSizer(bSizer2) self.resource_panel.Layout() bSizer2.Fit(self.resource_panel) self.property_panel = wx.Panel(self.editor_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer3 = wx.BoxSizer(wx.VERTICAL) self.object_propertyGridManager = pg.PropertyGridManager( self.property_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.propgrid.PGMAN_DEFAULT_STYLE | wx.propgrid.PG_TOOLBAR) self.attributes_propertyGridPage = self.object_propertyGridManager.AddPage( _(u"Attributes"), wx.ArtProvider.GetBitmap(u"gtk-index", wx.ART_MENU)) self.methods_propertyGridPage = self.object_propertyGridManager.AddPage( _(u"Methods"), wx.ArtProvider.GetBitmap(u"gtk-properties", wx.ART_MENU)) self.events_propertyGridPage = self.object_propertyGridManager.AddPage( _(u"Events"), wx.ArtProvider.GetBitmap(u"gtk-about", wx.ART_MENU)) bSizer3.Add(self.object_propertyGridManager, 1, wx.ALL | wx.EXPAND, 5) self.property_panel.SetSizer(bSizer3) self.property_panel.Layout() bSizer3.Fit(self.property_panel) self.editor_splitter.SplitHorizontally(self.resource_panel, self.property_panel, 0) bSizer1.Add(self.editor_splitter, 1, wx.EXPAND, 5) self.SetSizer(bSizer1) self.Layout() self.frame_statusBar = self.CreateStatusBar(1, 0, wx.ID_ANY) # Connect Events self.Bind(wx.EVT_TOOL, self.onNewToolClicked, id=self.new_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onOpenToolClicked, id=self.open_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onSaveToolClicked, id=self.save_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onSaveAsToolClicked, id=self.saveas_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onTestToolClicked, id=self.test_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onDesignToolClicked, id=self.design_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onModuleToolClicked, id=self.module_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onHelpToolClicked, id=self.help_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onCollapseToolClicked, id=self.collapse_tool.GetId()) self.Bind(wx.EVT_TOOL, self.onExpandToolClicked, id=self.expand_tool.GetId()) self.resource_treeListCtrl.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.onResTreelistItemContextMenu) self.resource_treeListCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, self.onResItemTreelistSelectionChanged) self.object_propertyGridManager.Bind(pg.EVT_PG_CHANGED, self.onObjPropertyGridChanged)
def __init__(self, parent, title, tree, key): wx.Dialog.__init__(self, parent, -1, title, style=wx.DEFAULT_DIALOG_STYLE, size=wx.Size((300, 480))) # wx.Panel.__init__(self, parent, wx.ID_ANY) self.app = parent self.panel = panel = wx.Panel(self, wx.ID_ANY) topsizer = wx.BoxSizer(wx.VERTICAL) # Difference between using PropertyGridManager vs PropertyGrid is that # the manager supports multiple pages and a description box. self.pg = pg = wxpg.PropertyGridManager( panel, style=wxpg.PG_SPLITTER_AUTO_CENTER) # Show help as tooltips pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange) pg.Bind(wxpg.EVT_PG_SELECTED, self.OnPropGridSelect) pg.AddPage('Page 1') self.key = key for page in tree: pg.Append(wxpg.PropertyCategory(page[0])) for item in page[1]: v = item[1] if v[0] == 'int': pg.Append(wxpg.IntProperty(v[1], value=int(v[2]) or 0)) if v[0] == 'float': pg.Append(wxpg.FloatProperty(v[1], value=float(v[2]) or 0)) if v[0] == 'str': pg.Append(wxpg.StringProperty(v[1], value=v[2] or '')) if v[0] == 'txt': pg.Append(wxpg.LongStringProperty(v[1], value=v[2] or '')) if v[0] == 'bool': pg.Append(wxpg.BoolProperty(v[1])) if v[0] == 'date': pg.Append(wxpg.DateProperty(v[1], value=wx.DateTime.Now())) if v[0] == 'list': pg.Append( wxpg.EnumProperty( v[1], v[1], [i.strip() for i in v[2][1:-1].split(',')])) if v[0] == 'img': pg.Append( wxpg.EnumProperty(v[1], v[1], self.app.img_names())) if v[0] == 'tab': pg.Append( wxpg.EnumProperty(v[1], v[1], self.app.table_names())) topsizer.Add(pg, 1, wx.EXPAND) self.txt_info = wx.TextCtrl(self, wx.ID_ANY, 'information', wx.DefaultPosition, wx.Size(80, 80), wx.TE_MULTILINE | wx.TRANSPARENT_WINDOW) topsizer.Add(self.txt_info, 0, wx.EXPAND | wx.ALL, 0) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(panel, wx.ID_OK, "OK") rowsizer.Add(but, 1) #but.Bind( wx.EVT_BUTTON, self.OnGetPropertyValues ) but = wx.Button(panel, wx.ID_CANCEL, "Cancel") rowsizer.Add(but, 1) topsizer.Add(rowsizer, 0, wx.EXPAND) panel.SetSizer(topsizer) topsizer.SetSizeHints(panel) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel, 1, wx.EXPAND) self.SetSizer(sizer) self.SetAutoLayout(True)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 736,490 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) #self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) self.SetBackgroundColour( wx.Colour( 12, 24, 33 ) ) self.m_statusBar1 = self.CreateStatusBar( 1, 0, wx.ID_ANY ) self.m_statusBar1.SetBackgroundColour( wx.Colour( 12, 24, 33 ) ) self.m_menubar1 = wx.MenuBar( 0 ) self.m_menubar1.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BACKGROUND ) ) self.m_menubar1.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INACTIVECAPTIONTEXT ) ) self.m_menu1 = wx.Menu() self.m_menubar1.Append( self.m_menu1, u"File" ) self.m_menu2 = wx.Menu() self.m_menubar1.Append( self.m_menu2, u"view" ) self.SetMenuBar( self.m_menubar1 ) bSizer1 = wx.BoxSizer( wx.HORIZONTAL ) bSizer3 = wx.BoxSizer( wx.HORIZONTAL ) self.m_scrolledWindow1 = wx.ScrolledWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 10,-1 ), wx.HSCROLL|wx.VSCROLL ) self.m_scrolledWindow1.SetScrollRate( 5, 5 ) self.m_scrolledWindow1.SetMaxSize( wx.Size( 100,-1 ) ) bSizer3.Add( self.m_scrolledWindow1, 1, wx.EXPAND |wx.ALL, 5 ) self.m_auinotebook1 = wx.aui.AuiNotebook( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 450,-1 ), wx.aui.AUI_NB_DEFAULT_STYLE ) self.m_auinotebook1.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INACTIVECAPTIONTEXT ) ) self.m_auinotebook1.SetBackgroundColour( wx.Colour( 27, 42, 65 ) ) self.m_auinotebook1.SetMaxSize( wx.Size( 400,-1 ) ) bSizer3.Add( self.m_auinotebook1, 1, wx.EXPAND |wx.ALL, 5 ) bSizer2 = wx.BoxSizer( wx.VERTICAL ) self.m_dataViewCtrl1 = wx.dataview.DataViewCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 130,200 ), 0 ) bSizer2.Add( self.m_dataViewCtrl1, 0, wx.ALL, 5 ) self.m_propertyGridManager1 = pg.PropertyGridManager(self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 130,200 ), wx.propgrid.PGMAN_DEFAULT_STYLE) self.m_propertyGridManager1.SetExtraStyle( wx.propgrid.PG_EX_MODE_BUTTONS ) self.m_propertyGridPage1 = self.m_propertyGridManager1.AddPage( u"Page", wx.NullBitmap ); self.m_propertyGridItem1 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem6 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem7 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem8 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem9 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem2 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem3 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem4 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) self.m_propertyGridItem5 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Name", u"Name" ) ) bSizer2.Add() ##bSizer2.Add( self.m_propertyGridManager1, 0, wx.ALL, 5 ) bSizer3.Add( bSizer2, 1, wx.EXPAND, 5 ) bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 ) self.SetSizer(bSizer1) #self.SetSizer( bSizer1 ) self.Layout()
def __init__(self, parent, log): wx.Panel.__init__(self, parent, wx.ID_ANY) self.log = log self.panel = panel = wx.Panel(self, wx.ID_ANY) topsizer = wx.BoxSizer(wx.VERTICAL) # Difference between using PropertyGridManager vs PropertyGrid is that # the manager supports multiple pages and a description box. self.pg = pg = wxpg.PropertyGridManager( panel, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) # Show help as tooltips pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange) pg.Bind(wxpg.EVT_PG_PAGE_CHANGED, self.OnPropGridPageChange) pg.Bind(wxpg.EVT_PG_SELECTED, self.OnPropGridSelect) pg.Bind(wxpg.EVT_PG_RIGHT_CLICK, self.OnPropGridRightClick) # # Let's use some simple custom editor # # NOTE: Editor must be registered *before* adding a property that # uses it. if not getattr(sys, '_PropGridEditorsRegistered', False): pg.RegisterEditor(TrivialPropertyEditor) pg.RegisterEditor(SampleMultiButtonEditor) pg.RegisterEditor(LargeImageEditor) # ensure we only do it once sys._PropGridEditorsRegistered = True # # Add properties # pg.AddPage("Page 1 - Testing All") pg.Append(wxpg.PropertyCategory("1 - Basic Properties")) pg.Append(wxpg.StringProperty("String", value="Some Text")) sp = pg.Append( wxpg.StringProperty('StringProperty w/ Password flag', value='ABadPassword')) sp.SetAttribute('Hint', 'This is a hint') sp.SetAttribute('Password', True) pg.Append(wxpg.IntProperty("Int", value=100)) pg.Append(wxpg.FloatProperty("Float", value=100.0)) pg.Append(wxpg.BoolProperty("Bool", value=True)) boolprop = pg.Append( wxpg.BoolProperty("Bool_with_Checkbox", value=True)) pg.SetPropertyAttribute( "Bool_with_Checkbox", # You can find the property by name, #boolprop, # or give the property object itself. "UseCheckbox", True) # The attribute name and value pg.Append(wxpg.PropertyCategory("2 - More Properties")) pg.Append( wxpg.LongStringProperty( "LongString", value="This is a\nmulti-line string\nwith\ttabs\nmixed\tin.")) pg.Append(wxpg.DirProperty("Dir", value=r"C:\Windows")) pg.Append(wxpg.FileProperty("File", value=r"C:\Windows\system.ini")) pg.Append( wxpg.ArrayStringProperty("ArrayString", value=['A', 'B', 'C'])) pg.Append( wxpg.EnumProperty( "Enum", "Enum", ['wxPython Rules', 'wxPython Rocks', 'wxPython Is The Best'], [10, 11, 12], 0)) pg.Append( wxpg.EditEnumProperty("EditEnum", "EditEnumProperty", ['A', 'B', 'C'], [0, 1, 2], "Text Not in List")) pg.Append(wxpg.PropertyCategory("3 - Advanced Properties")) pg.Append(wxpg.DateProperty("Date", value=wx.DateTime.Now())) pg.Append(wxpg.FontProperty("Font", value=panel.GetFont())) pg.Append( wxpg.ColourProperty("Colour", value=panel.GetBackgroundColour())) pg.Append(wxpg.SystemColourProperty("SystemColour")) pg.Append(wxpg.ImageFileProperty("ImageFile")) pg.Append( wxpg.MultiChoiceProperty("MultiChoice", choices=['wxWidgets', 'QT', 'GTK+'])) pg.Append(wxpg.PropertyCategory("4 - Additional Properties")) #pg.Append( wxpg.PointProperty("Point",value=panel.GetPosition()) ) pg.Append(SizeProperty("Size", value=panel.GetSize())) #pg.Append( wxpg.FontDataProperty("FontData") ) pg.Append(wxpg.IntProperty("IntWithSpin", value=256)) pg.SetPropertyEditor("IntWithSpin", "SpinCtrl") pg.SetPropertyAttribute("File", wxpg.PG_FILE_SHOW_FULL_PATH, 0) pg.SetPropertyAttribute("File", wxpg.PG_FILE_INITIAL_PATH, r"C:\Program Files\Internet Explorer") pg.SetPropertyAttribute("Date", wxpg.PG_DATE_PICKER_STYLE, wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY) pg.Append(wxpg.PropertyCategory("5 - Custom Properties and Editors")) pg.Append(IntProperty2("IntProperty2", value=1024)) pg.Append(PyObjectProperty("PyObjectProperty")) pg.Append(DirsProperty("Dirs1", value=['C:/Lib', 'C:/Bin'])) pg.Append(DirsProperty("Dirs2", value=['/lib', '/bin'])) # Test another type of delimiter pg.SetPropertyAttribute("Dirs2", "Delimiter", '"') # SampleMultiButtonEditor pg.Append(wxpg.LongStringProperty("MultipleButtons")) pg.SetPropertyEditor("MultipleButtons", "SampleMultiButtonEditor") pg.Append(SingleChoiceProperty("SingleChoiceProperty")) # Custom editor samples prop = pg.Append( wxpg.StringProperty("StringWithCustomEditor", value="test value")) pg.SetPropertyEditor(prop, "TrivialPropertyEditor") pg.Append(wxpg.ImageFileProperty("ImageFileWithLargeEditor")) pg.SetPropertyEditor("ImageFileWithLargeEditor", "LargeImageEditor") # When page is added, it will become the target page for AutoFill # calls (and for other property insertion methods as well) pg.AddPage("Page 2 - Results of AutoFill will appear here") topsizer.Add(pg, 1, wx.EXPAND) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(panel, -1, "SetPropertyValues") but.Bind(wx.EVT_BUTTON, self.OnSetPropertyValues) rowsizer.Add(but, 1) but = wx.Button(panel, -1, "GetPropertyValues") but.Bind(wx.EVT_BUTTON, self.OnGetPropertyValues) rowsizer.Add(but, 1) topsizer.Add(rowsizer, 0, wx.EXPAND) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(panel, -1, "GetPropertyValues(as_strings=True)") but.Bind(wx.EVT_BUTTON, self.OnGetPropertyValues2) rowsizer.Add(but, 1) but = wx.Button(panel, -1, "AutoFill") but.Bind(wx.EVT_BUTTON, self.OnAutoFill) rowsizer.Add(but, 1) topsizer.Add(rowsizer, 0, wx.EXPAND) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(panel, -1, "Delete") but.Bind(wx.EVT_BUTTON, self.OnDeleteProperty) rowsizer.Add(but, 1) but = wx.Button(panel, -1, "Run Tests") but.Bind(wx.EVT_BUTTON, self.RunTests) rowsizer.Add(but, 1) topsizer.Add(rowsizer, 0, wx.EXPAND) panel.SetSizer(topsizer) topsizer.SetSizeHints(panel) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel, 1, wx.EXPAND) self.SetSizer(sizer) self.SetAutoLayout(True)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"UMLToCode", pos=wx.DefaultPosition, size=wx.Size(648, 569), style=wx.CAPTION | wx.CLOSE_BOX | wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT | wx.ICONIZE | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.m_mgr = wx.aui.AuiManager() self.m_mgr.SetManagedWindow(self) self.m_mgr.SetFlags(wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE | wx.aui.AUI_MGR_ALLOW_FLOATING | wx.aui.AUI_MGR_DEFAULT | wx.aui.AUI_MGR_HINT_FADE | wx.aui.AUI_MGR_LIVE_RESIZE) self.m_menubar1 = wx.MenuBar(0) self.file = wx.Menu() self.new = wx.MenuItem(self.file, ID_NEW, u"New" + u"\t" + u"Ctrl+N", wx.EmptyString, wx.ITEM_NORMAL) self.file.Append(self.new) self.open = wx.MenuItem(self.file, ID_OPEN, u"Open..." + u"\t" + u"Ctrl+O", wx.EmptyString, wx.ITEM_NORMAL) self.file.Append(self.open) self.file.AppendSeparator() self.save = wx.MenuItem(self.file, ID_SAVE, u"Save" + u"\t" + u"Ctrl+S", wx.EmptyString, wx.ITEM_NORMAL) self.file.Append(self.save) self.saveAs = wx.MenuItem(self.file, ID_SAVE_AS, u"Save As", wx.EmptyString, wx.ITEM_NORMAL) self.file.Append(self.saveAs) self.file.AppendSeparator() self.exit = wx.MenuItem(self.file, ID_EXIT, u"Exit" + u"\t" + u"Alt+X", wx.EmptyString, wx.ITEM_NORMAL) self.file.Append(self.exit) self.m_menubar1.Append(self.file, u"File") self.edit = wx.Menu() self.cut = wx.MenuItem(self.edit, ID_CUT, u"Cut" + u"\t" + u"Ctrl+X", wx.EmptyString, wx.ITEM_NORMAL) self.edit.Append(self.cut) self.copy = wx.MenuItem(self.edit, ID_COPY, u"Copy" + u"\t" + u"Ctrl+C", wx.EmptyString, wx.ITEM_NORMAL) self.edit.Append(self.copy) self.paste = wx.MenuItem(self.edit, ID_PASTE, u"Paste" + u"\t" + u"Ctrl+V", wx.EmptyString, wx.ITEM_NORMAL) self.edit.Append(self.paste) self.edit.AppendSeparator() self.select = wx.MenuItem(self.edit, ID_SELECT, u"Select", wx.EmptyString, wx.ITEM_NORMAL) self.edit.Append(self.select) self.selectAll = wx.MenuItem(self.edit, ID_SELECT_ALL, u"Select All" + u"\t" + u"Ctrl+A", wx.EmptyString, wx.ITEM_NORMAL) self.edit.Append(self.selectAll) self.m_menubar1.Append(self.edit, u"Edit") self.run = wx.Menu() self.build = wx.MenuItem(self.run, ID_BUILD, u"Build" + u"\t" + u"Ctrl+B", wx.EmptyString, wx.ITEM_NORMAL) self.run.Append(self.build) self.clean = wx.MenuItem(self.run, ID_CLEAN, u"Clean", wx.EmptyString, wx.ITEM_NORMAL) self.run.Append(self.clean) self.showFiles = wx.MenuItem(self.run, ID_SHOW_FILES, u"Show Files", wx.EmptyString, wx.ITEM_NORMAL) self.run.Append(self.showFiles) self.m_menubar1.Append(self.run, u"Run") self.tools = wx.Menu() self.options = wx.MenuItem(self.tools, ID_OPTIONS, u"Options..." + u"\t" + u"Ctrl+O", wx.EmptyString, wx.ITEM_NORMAL) self.tools.Append(self.options) self.m_menubar1.Append(self.tools, u"Tools") self.windows = wx.Menu() self.m_menubar1.Append(self.windows, u"Windows") self.help = wx.Menu() self.content = wx.MenuItem(self.help, ID_CONTENT, u"Content", wx.EmptyString, wx.ITEM_NORMAL) self.help.Append(self.content) self.about = wx.MenuItem(self.help, ID_ABOUT, u"About", wx.EmptyString, wx.ITEM_NORMAL) self.help.Append(self.about) self.m_menubar1.Append(self.help, u"Help") self.SetMenuBar(self.m_menubar1) self.m_panel_tools = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL, u"tools_pane") self.m_mgr.AddPane( self.m_panel_tools, wx.aui.AuiPaneInfo().Left().Caption(u"Tools").PinButton(True). Gripper().Dock().Resizable().FloatingSize(wx.Size( 100, 250)).BottomDockable(False).TopDockable(False).BestSize( wx.Size(100, -1)).MaxSize(wx.Size(200, -1)).Layer(2)) bSizer2 = wx.BoxSizer(wx.VERTICAL) self.m_panel_tools.SetSizer(bSizer2) self.m_panel_tools.Layout() bSizer2.Fit(self.m_panel_tools) self.m_toolBar_main = wx.ToolBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL) self.m_tool_new = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"New", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/new.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, u"Create new file", None) self.m_tool_open = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Open", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/open.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_toolBar_main.AddSeparator() self.m_tool_save = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Save", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/save.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_toolBar_main.AddSeparator() self.m_tool_undo = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Undo", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/undo.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_tool_redo = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Redo", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/redo.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_toolBar_main.AddSeparator() self.m_tool_cut = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Cut", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/cut.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_tool_copy = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Copy", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/copy.xpm", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_tool_paste = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Paste", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/paste.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_toolBar_main.AddSeparator() self.m_tool_build = self.m_toolBar_main.AddLabelTool( wx.ID_ANY, u"Build", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/events.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None) self.m_toolBar_main.Realize() self.m_mgr.AddPane( self.m_toolBar_main, wx.aui.AuiPaneInfo().Top().CaptionVisible(False). CloseButton(False).Gripper().Dock().Resizable().FloatingSize( wx.DefaultSize).BottomDockable(False).Layer(10).ToolbarPane()) self.m_auinotebook_editor = wx.aui.AuiNotebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.aui.AUI_NB_CLOSE_BUTTON | wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB | wx.aui.AUI_NB_DEFAULT_STYLE | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.aui.AUI_NB_TAB_MOVE | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_WINDOWLIST_BUTTON) self.m_mgr.AddPane( self.m_auinotebook_editor, wx.aui.AuiPaneInfo().Center().Caption(u"Editor").PinButton( True).Gripper().Dock().Resizable().FloatingSize( wx.DefaultSize).BottomDockable( False).CentrePane().DefaultPane()) self.m_scrolledWindow_designer = wx.ScrolledWindow( self.m_auinotebook_editor, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL | wx.VSCROLL) self.m_scrolledWindow_designer.SetScrollRate(5, 5) self.m_auinotebook_editor.AddPage(self.m_scrolledWindow_designer, u"Designer", True, wx.NullBitmap) self.m_scrolledWindow_code = wx.ScrolledWindow( self.m_auinotebook_editor, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL | wx.VSCROLL) self.m_scrolledWindow_code.SetScrollRate(5, 5) self.m_auinotebook_editor.AddPage(self.m_scrolledWindow_code, u"Code", False, wx.NullBitmap) self.m_panel_messages = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_mgr.AddPane( self.m_panel_messages, wx.aui.AuiPaneInfo().Bottom().Caption(u"Messages").PinButton( True).Gripper().Dock().Resizable().FloatingSize( wx.Size(-1, 100)).TopDockable(False).LeftDockable( False).RightDockable(False).BestSize(wx.Size( -1, 100)).MaxSize(wx.Size(-1, 100))) bSizer4 = wx.BoxSizer(wx.VERTICAL) self.m_dataViewListCtrl_messages_dv = wx.dataview.DataViewListCtrl( self.m_panel_messages, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.dataview.DV_HORIZ_RULES | wx.dataview.DV_ROW_LINES | wx.dataview.DV_VERT_RULES) self.m_dataViewListColumn_name = self.m_dataViewListCtrl_messages_dv.AppendTextColumn( u"Name") self.m_dataViewListColumn_desc = self.m_dataViewListCtrl_messages_dv.AppendTextColumn( u"Description") self.m_dataViewListColumn_type = self.m_dataViewListCtrl_messages_dv.AppendIconTextColumn( u"Type") self.m_dataViewListColumn_location = self.m_dataViewListCtrl_messages_dv.AppendTextColumn( u"Location") bSizer4.Add(self.m_dataViewListCtrl_messages_dv, 100, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 1) self.m_panel_messages.SetSizer(bSizer4) self.m_panel_messages.Layout() bSizer4.Fit(self.m_panel_messages) self.m_panel_properties = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_mgr.AddPane( self.m_panel_properties, wx.aui.AuiPaneInfo().Right().Caption(u"Properties").PinButton( True).Gripper().Dock().Resizable().FloatingSize( wx.Size( 150, -1)).BottomDockable(False).TopDockable(False).BestSize( wx.Size(150, -1)).MaxSize(wx.Size(150, -1))) bSizer3 = wx.BoxSizer(wx.VERTICAL) self.m_propertyGridManager_main = pg.PropertyGridManager( self.m_panel_properties, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.propgrid.PGMAN_DEFAULT_STYLE | wx.propgrid.PG_ALPHABETIC_MODE | wx.propgrid.PG_AUTO_SORT | wx.propgrid.PG_BOLD_MODIFIED | wx.propgrid.PG_DESCRIPTION | wx.propgrid.PG_TOOLBAR | wx.propgrid.PG_TOOLTIPS) self.m_propertyGridManager_main.SetExtraStyle( wx.propgrid.PG_EX_HELP_AS_TOOLTIPS | wx.propgrid.PG_EX_MODE_BUTTONS) self.m_propertyGridPage_default = self.m_propertyGridManager_main.AddPage( u"Default", wx.Bitmap( u"../../wxFormBuilder/output/resources/icons/properties.png", wx.BITMAP_TYPE_ANY)) self.m_propertyGridItem_name = self.m_propertyGridPage_default.Append( pg.StringProperty(u"Name", u"Name")) self.m_propertyGridItem_desc = self.m_propertyGridPage_default.Append( pg.StringProperty(u"Description", u"Description")) self.m_propertyGridPage_events = self.m_propertyGridManager_main.AddPage( u"Events", wx.Bitmap(u"../../wxFormBuilder/output/resources/icons/events.png", wx.BITMAP_TYPE_ANY)) self.m_propertyGridItem_on_loaded = self.m_propertyGridPage_events.Append( pg.StringProperty(u"OnLoaded", u"OnLoaded")) self.m_propertyGridItem_on_unloaded = self.m_propertyGridPage_events.Append( pg.StringProperty(u"OnUnloaded", u"OnUnloaded")) bSizer3.Add(self.m_propertyGridManager_main, 100, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 1) self.m_panel_properties.SetSizer(bSizer3) self.m_panel_properties.Layout() bSizer3.Fit(self.m_panel_properties) self.m_statusBar_main = self.CreateStatusBar(1, wx.STB_SIZEGRIP, wx.ID_ANY) self.m_panel_project = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel_project.Hide() self.m_mgr.AddPane( self.m_panel_project, wx.aui.AuiPaneInfo().Left().Caption(u"Project").PinButton( True).Gripper().Dock().Resizable().FloatingSize( wx.Size(150, 250)).BottomDockable( False).TopDockable(False).Row(0).Position(1).BestSize( wx.Size(150, -1)).MaxSize(wx.Size(200, -1)).Layer(2)) bSizer5 = wx.BoxSizer(wx.VERTICAL) self.m_genericDirCtrl_project = wx.GenericDirCtrl( self.m_panel_project, wx.ID_ANY, u".", wx.DefaultPosition, wx.DefaultSize, wx.DIRCTRL_3D_INTERNAL | wx.DIRCTRL_EDIT_LABELS | wx.DIRCTRL_MULTIPLE | wx.DIRCTRL_SELECT_FIRST | wx.DIRCTRL_SHOW_FILTERS | wx.SUNKEN_BORDER, wx.EmptyString, 0) self.m_genericDirCtrl_project.ShowHidden(False) bSizer5.Add(self.m_genericDirCtrl_project, 100, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 1) self.m_panel_project.SetSizer(bSizer5) self.m_panel_project.Layout() bSizer5.Fit(self.m_panel_project) self.m_mgr.Update() self.Centre(wx.BOTH)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition, size=wx.Size(710, 490), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) self.m_statusBar1 = self.CreateStatusBar(1, 0, wx.ID_ANY) self.m_menubar1 = wx.MenuBar(0) self.m_menu1 = wx.Menu() self.m_menubar1.Append(self.m_menu1, u"File") self.SetMenuBar(self.m_menubar1) bSizer1 = wx.BoxSizer(wx.HORIZONTAL) self.m_auinotebook1 = wx.aui.AuiNotebook(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(550, -1), wx.aui.AUI_NB_DEFAULT_STYLE) bSizer1.Add(self.m_auinotebook1, 1, wx.EXPAND | wx.ALL, 5) bSizer2 = wx.BoxSizer(wx.VERTICAL) self.m_dataViewCtrl1 = wx.dataview.DataViewCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.Size(130, 200), 0) bSizer2.Add(self.m_dataViewCtrl1, 0, wx.ALL, 5) self.m_propertyGridManager1 = pg.PropertyGridManager( self, wx.ID_ANY, wx.DefaultPosition, wx.Size(130, 200), wx.propgrid.PGMAN_DEFAULT_STYLE) self.m_propertyGridManager1.SetExtraStyle( wx.propgrid.PG_EX_MODE_BUTTONS) self.m_propertyGridPage1 = self.m_propertyGridManager1.AddPage( u"Page", wx.NullBitmap) self.m_propertyGridItem1 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name", u"Name")) self.m_propertyGridItem6 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name1", u"Name1")) self.m_propertyGridItem7 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name2", u"Name2")) self.m_propertyGridItem8 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name3", u"Name3")) self.m_propertyGridItem9 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name4", u"Name4")) self.m_propertyGridItem2 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name5", u"Name5")) self.m_propertyGridItem3 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name6", u"Name6")) self.m_propertyGridItem4 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name7", u"Name7")) self.m_propertyGridItem5 = self.m_propertyGridPage1.Append( pg.StringProperty(u"Name8", u"Name8")) bSizer2.Add(self.m_propertyGridManager1, 0, wx.ALL, 5) bSizer1.Add(bSizer2, 1, wx.EXPAND, 5) self.SetSizer(bSizer1) self.Layout() self.Centre(wx.BOTH)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( -1,630 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.Size( 695,630 ), wx.DefaultSize ) bSizer_csc_mainPanel = wx.BoxSizer( wx.VERTICAL ) self.m_listbook_menu = wx.Listbook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT|wx.RAISED_BORDER ) m_listbook_menuImageSize = wx.Size( 64,64 ) m_listbook_menuIndex = 0 m_listbook_menuImages = wx.ImageList( m_listbook_menuImageSize.GetWidth(), m_listbook_menuImageSize.GetHeight() ) self.m_listbook_menu.AssignImageList( m_listbook_menuImages ) self.m_panel_csc = wx.Panel( self.m_listbook_menu, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer_csc = wx.BoxSizer( wx.VERTICAL ) self.m_notebook_csc = wx.Notebook( self.m_panel_csc, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_panel_csc1 = wx.Panel( self.m_notebook_csc, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer_csc1 = wx.BoxSizer( wx.VERTICAL ) self.m_grid_csc1 = wx.grid.Grid( self.m_panel_csc1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.m_grid_csc1.CreateGrid( 30, 5 ) self.m_grid_csc1.EnableEditing( False ) self.m_grid_csc1.EnableGridLines( True ) self.m_grid_csc1.EnableDragGridSize( False ) self.m_grid_csc1.SetMargins( 0, 0 ) # Columns self.m_grid_csc1.EnableDragColMove( False ) self.m_grid_csc1.EnableDragColSize( True ) self.m_grid_csc1.SetColLabelSize( 30 ) self.m_grid_csc1.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) # Rows self.m_grid_csc1.EnableDragRowSize( True ) self.m_grid_csc1.SetRowLabelSize( 80 ) self.m_grid_csc1.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) # Label Appearance # Cell Defaults self.m_grid_csc1.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) bSizer_csc1.Add( self.m_grid_csc1, 0, wx.ALL|wx.EXPAND, 5 ) self.m_panel_csc1.SetSizer( bSizer_csc1 ) self.m_panel_csc1.Layout() bSizer_csc1.Fit( self.m_panel_csc1 ) self.m_notebook_csc.AddPage( self.m_panel_csc1, u"CSC1", True ) self.m_panel_csc2 = wx.Panel( self.m_notebook_csc, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer_csc2 = wx.BoxSizer( wx.VERTICAL ) self.m_grid_csc2 = wx.grid.Grid( self.m_panel_csc2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.m_grid_csc2.CreateGrid( 30, 5 ) self.m_grid_csc2.EnableEditing( True ) self.m_grid_csc2.EnableGridLines( True ) self.m_grid_csc2.EnableDragGridSize( False ) self.m_grid_csc2.SetMargins( 0, 0 ) # Columns self.m_grid_csc2.EnableDragColMove( False ) self.m_grid_csc2.EnableDragColSize( True ) self.m_grid_csc2.SetColLabelSize( 30 ) self.m_grid_csc2.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) # Rows self.m_grid_csc2.EnableDragRowSize( True ) self.m_grid_csc2.SetRowLabelSize( 80 ) self.m_grid_csc2.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) # Label Appearance # Cell Defaults self.m_grid_csc2.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) bSizer_csc2.Add( self.m_grid_csc2, 0, wx.ALL|wx.EXPAND, 5 ) self.m_panel_csc2.SetSizer( bSizer_csc2 ) self.m_panel_csc2.Layout() bSizer_csc2.Fit( self.m_panel_csc2 ) self.m_notebook_csc.AddPage( self.m_panel_csc2, u"CSC2", False ) self.m_panel_csc3 = wx.Panel( self.m_notebook_csc, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer_csc3 = wx.BoxSizer( wx.VERTICAL ) self.m_grid_csc3 = wx.grid.Grid( self.m_panel_csc3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.m_grid_csc3.CreateGrid( 30, 5 ) self.m_grid_csc3.EnableEditing( True ) self.m_grid_csc3.EnableGridLines( True ) self.m_grid_csc3.EnableDragGridSize( False ) self.m_grid_csc3.SetMargins( 0, 0 ) # Columns self.m_grid_csc3.EnableDragColMove( False ) self.m_grid_csc3.EnableDragColSize( True ) self.m_grid_csc3.SetColLabelSize( 30 ) self.m_grid_csc3.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) # Rows self.m_grid_csc3.EnableDragRowSize( True ) self.m_grid_csc3.SetRowLabelSize( 80 ) self.m_grid_csc3.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) # Label Appearance # Cell Defaults self.m_grid_csc3.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) bSizer_csc3.Add( self.m_grid_csc3, 0, wx.ALL|wx.EXPAND, 5 ) self.m_panel_csc3.SetSizer( bSizer_csc3 ) self.m_panel_csc3.Layout() bSizer_csc3.Fit( self.m_panel_csc3 ) self.m_notebook_csc.AddPage( self.m_panel_csc3, u"CSC3", False ) bSizer_csc.Add( self.m_notebook_csc, 1, wx.EXPAND |wx.ALL, 5 ) self.m_panel_csc.SetSizer( bSizer_csc ) self.m_panel_csc.Layout() bSizer_csc.Fit( self.m_panel_csc ) self.m_listbook_menu.AddPage( self.m_panel_csc, u"CSC", False ) m_listbook_menuBitmap = wx.Bitmap( u"src/1.png", wx.BITMAP_TYPE_ANY ) if ( m_listbook_menuBitmap.Ok() ): m_listbook_menuImages.Add( m_listbook_menuBitmap ) self.m_listbook_menu.SetPageImage( m_listbook_menuIndex, m_listbook_menuIndex ) m_listbook_menuIndex += 1 self.m_panel_bms = wx.Panel( self.m_listbook_menu, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer_bms = wx.BoxSizer( wx.VERTICAL ) bSizer38 = wx.BoxSizer( wx.VERTICAL ) bSizer38.SetMinSize( wx.Size( -1,205 ) ) self.m_propertyGridManager1 = pg.PropertyGridManager(self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), wx.propgrid.PGMAN_DEFAULT_STYLE|wx.propgrid.PG_SPLITTER_AUTO_CENTER) self.m_propertyGridManager1.Enable( False ) self.m_propertyGridPage1 = self.m_propertyGridManager1.AddPage( u"Page", wx.NullBitmap ); self.m_propertyGridItem1 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Battery State", u"Battery State" ) ) self.m_propertyGridItem9 = self.m_propertyGridPage1.Append( pg.FloatProperty( u"Voltage(V)", u"Voltage(V)" ) ) self.m_propertyGridItem2 = self.m_propertyGridPage1.Append( pg.FloatProperty( u"Current(A)", u"Current(A)" ) ) self.m_propertyGridItem3 = self.m_propertyGridPage1.Append( pg.IntProperty( u"Nominal Capacity(Ah)", u"Nominal Capacity(Ah)" ) ) self.m_propertyGridItem4 = self.m_propertyGridPage1.Append( pg.FloatProperty( u"Current Capacity(KWh)", u"Current Capacity(KWh)" ) ) self.m_propertyGridItem5 = self.m_propertyGridPage1.Append( pg.FloatProperty( u"SOC(%)", u"SOC(%)" ) ) self.m_propertyGridItem6 = self.m_propertyGridPage1.Append( pg.IntProperty( u"SOH(%)", u"SOH(%)" ) ) self.m_propertyGridItem7 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Pack SN.", u"Pack SN." ) ) self.m_propertyGridItem8 = self.m_propertyGridPage1.Append( pg.StringProperty( u"Version", u"Version" ) ) bSizer38.Add( self.m_propertyGridManager1, 1, wx.EXPAND, 5 ) bSizer_bms.Add( bSizer38, 0, wx.EXPAND, 5 ) bSizer_bms.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticline1 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer_bms.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 ) self.m_staticText1 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"***** Error/Warning Status *****", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) self.m_staticText1.Wrap( -1 ) bSizer_bms.Add( self.m_staticText1, 0, wx.EXPAND, 5 ) self.m_staticline2 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer_bms.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 ) bSizer11 = wx.BoxSizer( wx.HORIZONTAL ) bSizer12 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText2 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"MainPosRelay", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText2.Wrap( -1 ) bSizer12.Add( self.m_staticText2, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline12 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer12.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 ) self.m_bitmap1 = wx.StaticBitmap( self.m_panel_bms, wx.ID_ANY, wx.Bitmap( u"src/11.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer12.Add( self.m_bitmap1, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer11.Add( bSizer12, 1, wx.EXPAND, 5 ) bSizer13 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText3 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"MainNegRelay", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) bSizer13.Add( self.m_staticText3, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline13 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer13.Add( self.m_staticline13, 0, wx.EXPAND |wx.ALL, 5 ) self.m_bitmap2 = wx.StaticBitmap( self.m_panel_bms, wx.ID_ANY, wx.Bitmap( u"src/11.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer13.Add( self.m_bitmap2, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer11.Add( bSizer13, 1, wx.EXPAND, 5 ) self.m_staticline9 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL ) bSizer11.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 ) bSizer14 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText4 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"ISO Normal", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText4.Wrap( -1 ) bSizer14.Add( self.m_staticText4, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline21 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer14.Add( self.m_staticline21, 0, wx.EXPAND |wx.ALL, 5 ) self.m_bitmap3 = wx.StaticBitmap( self.m_panel_bms, wx.ID_ANY, wx.Bitmap( u"src/11.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer14.Add( self.m_bitmap3, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer11.Add( bSizer14, 1, wx.EXPAND, 5 ) bSizer141 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText41 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"ISO Warning", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText41.Wrap( -1 ) bSizer141.Add( self.m_staticText41, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline22 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer141.Add( self.m_staticline22, 0, wx.EXPAND |wx.ALL, 5 ) self.m_bitmap31 = wx.StaticBitmap( self.m_panel_bms, wx.ID_ANY, wx.Bitmap( u"src/11.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer141.Add( self.m_bitmap31, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer11.Add( bSizer141, 1, wx.EXPAND, 5 ) bSizer142 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText42 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"ISO Error", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText42.Wrap( -1 ) bSizer142.Add( self.m_staticText42, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline23 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer142.Add( self.m_staticline23, 0, wx.EXPAND |wx.ALL, 5 ) self.m_bitmap32 = wx.StaticBitmap( self.m_panel_bms, wx.ID_ANY, wx.Bitmap( u"src/11.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer142.Add( self.m_bitmap32, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer11.Add( bSizer142, 1, wx.EXPAND, 5 ) bSizer_bms.Add( bSizer11, 0, wx.EXPAND, 5 ) self.m_staticline30 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer_bms.Add( self.m_staticline30, 0, wx.EXPAND |wx.ALL, 5 ) bSizer_bms.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticline3 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer_bms.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 ) self.m_staticText5 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"***** User Control Area *****", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) self.m_staticText5.Wrap( -1 ) bSizer_bms.Add( self.m_staticText5, 0, wx.EXPAND, 5 ) self.m_staticline4 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer_bms.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 ) bSizer15 = wx.BoxSizer( wx.HORIZONTAL ) bSizer37 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText25 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"User Name", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText25.Wrap( -1 ) bSizer37.Add( self.m_staticText25, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_textCtrl2 = wx.TextCtrl( self.m_panel_bms, wx.ID_ANY, u"admin", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer37.Add( self.m_textCtrl2, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline25 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer37.Add( self.m_staticline25, 0, wx.EXPAND |wx.ALL, 5 ) self.m_staticText26 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"Password", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText26.Wrap( -1 ) bSizer37.Add( self.m_staticText26, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_textCtrl1 = wx.TextCtrl( self.m_panel_bms, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PASSWORD|wx.TE_PROCESS_ENTER ) bSizer37.Add( self.m_textCtrl1, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer15.Add( bSizer37, 1, wx.EXPAND, 5 ) self.m_staticline27 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL ) bSizer15.Add( self.m_staticline27, 0, wx.EXPAND |wx.ALL, 5 ) bSizer36 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText21 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"Close Time", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText21.Wrap( -1 ) bSizer36.Add( self.m_staticText21, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticText14 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"00:00:00", wx.DefaultPosition, wx.Size( -1,25 ), 0 ) self.m_staticText14.Wrap( -1 ) bSizer36.Add( self.m_staticText14, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline24 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer36.Add( self.m_staticline24, 0, wx.EXPAND |wx.ALL, 5 ) self.m_staticText22 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"MainRelay", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText22.Wrap( -1 ) bSizer36.Add( self.m_staticText22, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_button14 = wx.Button( self.m_panel_bms, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button14.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) self.m_button14.Enable( False ) bSizer36.Add( self.m_button14, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer15.Add( bSizer36, 1, wx.EXPAND, 5 ) self.m_staticline28 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL ) bSizer15.Add( self.m_staticline28, 0, wx.EXPAND |wx.ALL, 5 ) bSizer35 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText23 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"Open(Cur<1A)", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText23.Wrap( -1 ) bSizer35.Add( self.m_staticText23, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_button10 = wx.Button( self.m_panel_bms, wx.ID_ANY, u"Open", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button10.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) bSizer35.Add( self.m_button10, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_staticline26 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer35.Add( self.m_staticline26, 0, wx.EXPAND |wx.ALL, 5 ) self.m_staticText24 = wx.StaticText( self.m_panel_bms, wx.ID_ANY, u"EmergencyOpen", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText24.Wrap( -1 ) bSizer35.Add( self.m_staticText24, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.m_button11 = wx.Button( self.m_panel_bms, wx.ID_ANY, u"SOS Open", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button11.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) self.m_button11.SetMinSize( wx.Size( 140,50 ) ) bSizer35.Add( self.m_button11, 1, wx.ALIGN_CENTER|wx.ALL, 5 ) bSizer15.Add( bSizer35, 1, wx.EXPAND, 5 ) self.m_staticline31 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer15.Add( self.m_staticline31, 0, wx.EXPAND |wx.ALL, 5 ) bSizer_bms.Add( bSizer15, 0, wx.EXPAND, 5 ) self.m_staticline32 = wx.StaticLine( self.m_panel_bms, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer_bms.Add( self.m_staticline32, 0, wx.EXPAND |wx.ALL, 5 ) bSizer_bms.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_panel_bms.SetSizer( bSizer_bms ) self.m_panel_bms.Layout() bSizer_bms.Fit( self.m_panel_bms ) self.m_listbook_menu.AddPage( self.m_panel_bms, u"BMS", True ) m_listbook_menuBitmap = wx.Bitmap( u"src/2.png", wx.BITMAP_TYPE_ANY ) if ( m_listbook_menuBitmap.Ok() ): m_listbook_menuImages.Add( m_listbook_menuBitmap ) self.m_listbook_menu.SetPageImage( m_listbook_menuIndex, m_listbook_menuIndex ) m_listbook_menuIndex += 1 self.m_panel_car = wx.Panel( self.m_listbook_menu, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_listbook_menu.AddPage( self.m_panel_car, u"Car", False ) m_listbook_menuBitmap = wx.Bitmap( u"src/3.png", wx.BITMAP_TYPE_ANY ) if ( m_listbook_menuBitmap.Ok() ): m_listbook_menuImages.Add( m_listbook_menuBitmap ) self.m_listbook_menu.SetPageImage( m_listbook_menuIndex, m_listbook_menuIndex ) m_listbook_menuIndex += 1 self.m_panel_setting = wx.Panel( self.m_listbook_menu, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_listbook_menu.AddPage( self.m_panel_setting, u"Setting", False ) m_listbook_menuBitmap = wx.Bitmap( u"src/4.png", wx.BITMAP_TYPE_ANY ) if ( m_listbook_menuBitmap.Ok() ): m_listbook_menuImages.Add( m_listbook_menuBitmap ) self.m_listbook_menu.SetPageImage( m_listbook_menuIndex, m_listbook_menuIndex ) m_listbook_menuIndex += 1 self.m_panel_diag = wx.Panel( self.m_listbook_menu, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_listbook_menu.AddPage( self.m_panel_diag, u"Diag", False ) m_listbook_menuBitmap = wx.Bitmap( u"src/5.png", wx.BITMAP_TYPE_ANY ) if ( m_listbook_menuBitmap.Ok() ): m_listbook_menuImages.Add( m_listbook_menuBitmap ) self.m_listbook_menu.SetPageImage( m_listbook_menuIndex, m_listbook_menuIndex ) m_listbook_menuIndex += 1 bSizer_csc_mainPanel.Add( self.m_listbook_menu, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer_csc_mainPanel ) self.Layout() self.m_statusBar1 = self.CreateStatusBar( 1, wx.ST_SIZEGRIP, wx.ID_ANY ) self.Centre( wx.BOTH ) # Connect Events self.m_listbook_menu.Bind( wx.EVT_LISTBOOK_PAGE_CHANGED, self.funcMenuChanged ) self.m_listbook_menu.Bind( wx.EVT_LISTBOOK_PAGE_CHANGING, self.funcMenuChanging ) self.m_notebook_csc.Bind( wx.EVT_NOTEBOOK_PAGE_CHANGED, self.cscPageChanged ) self.m_notebook_csc.Bind( wx.EVT_NOTEBOOK_PAGE_CHANGING, self.cscPageChanging ) self.m_textCtrl1.Bind( wx.EVT_TEXT_ENTER, self.passwordInputFinished ) self.m_button14.Bind( wx.EVT_BUTTON, self.closeMainRelay ) self.m_button10.Bind( wx.EVT_BUTTON, self.openMainRelay ) self.m_button11.Bind( wx.EVT_BUTTON, self.openMainRelayEmergency )
def __init__(self, parent, log): # Use the WANTS_CHARS style so the panel doesn't eat the Return key. wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS) self.log = log tID = wx.NewId() topsizer = wx.BoxSizer(wx.VERTICAL) # Difference between using PropertyGridManager vs PropertyGrid is that # the manager supports multiple pages and a description box. self.pg = pg = wxpg.PropertyGridManager( self, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) # |wxpg.PG_DESCRIPTION #self.pg = pg = wxpg.PropertyGrid(self, # style=wxpg.PG_SPLITTER_AUTO_CENTER|wxpg.PG_AUTO_SORT) # Show help as tooltips pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS | wxpg.PG_EX_MULTIPLE_SELECTION) pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange) pg.Bind(wxpg.EVT_PG_PAGE_CHANGED, self.OnPropGridPageChange) pg.Bind(wxpg.EVT_PG_SELECTED, self.OnPropGridSelect) pg.Bind(wxpg.EVT_PG_RIGHT_CLICK, self.OnPropGridRightClick) # Needed by custom image editor wx.InitAllImageHandlers() # # Let's use some simple custom editor # # NOTE: Editor must be registered *before* adding a property that # uses it. pg.RegisterEditor(TrivialPropertyEditor) pg.RegisterEditor(LargeImageEditor) # # Add properties # pg.AddPage("Page 1 - Testing All") pg.Append(wxpg.PropertyCategory("1 - Basic Properties")) pg.Append(wxpg.StringProperty("String", value="Some Text")) pg.Append(wxpg.IntProperty("Int", value=100)) pg.Append(wxpg.FloatProperty("Float", value=100.0)) pg.Append(wxpg.BoolProperty("Bool", value=True)) pg.Append(wxpg.BoolProperty("Bool_with_Checkbox", value=True)) pg.SetPropertyAttribute("Bool_with_Checkbox", "UseCheckbox", True) pg.Append(wxpg.PropertyCategory("2 - More Properties")) pg.Append( wxpg.LongStringProperty( "LongString", value= "This is a\\nmulti-line string\\nwith\\ttabs\\nmixed\\tin.")) pg.Append(wxpg.DirProperty("Dir", value="C:\\Windows")) pg.Append(wxpg.FileProperty("File", value="C:\\Windows\\system.ini")) pg.Append( wxpg.ArrayStringProperty("ArrayString", value=['A', 'B', 'C'])) pg.Append( wxpg.EnumProperty( "Enum", "Enum", ['wxPython Rules', 'wxPython Rocks', 'wxPython Is The Best'], [10, 11, 12], 0)) pg.Append( wxpg.EditEnumProperty("EditEnum", "EditEnumProperty", ['A', 'B', 'C'], [0, 1, 2], "Text Not in List")) pg.Append(wxpg.PropertyCategory("3 - Advanced Properties")) pg.Append(wxpg.DateProperty("Date", value=wx.DateTime_Now())) pg.Append(wxpg.FontProperty("Font", value=self.GetFont())) pg.Append( wxpg.ColourProperty("Colour", value=self.GetBackgroundColour())) pg.Append(wxpg.SystemColourProperty("SystemColour")) pg.Append(wxpg.ImageFileProperty("ImageFile")) pg.Append( wxpg.MultiChoiceProperty("MultiChoice", choices=['wxWidgets', 'QT', 'GTK+'])) pg.Append(wxpg.PropertyCategory("4 - Additional Properties")) pg.Append(wxpg.PointProperty("Point", value=self.GetPosition())) pg.Append(wxpg.SizeProperty("Size", value=self.GetSize())) pg.Append(wxpg.FontDataProperty("FontData")) pg.Append(wxpg.IntProperty("IntWithSpin", value=256)) pg.SetPropertyEditor("IntWithSpin", "SpinCtrl") pg.Append(wxpg.DirsProperty("Dirs", value=['C:/Lib', 'C:/Bin'])) pg.SetPropertyHelpString("String", "String Property help string!") pg.SetPropertyHelpString("Dirs", "Dirs Property help string!") pg.SetPropertyAttribute("File", wxpg.PG_FILE_SHOW_FULL_PATH, 0) pg.SetPropertyAttribute("File", wxpg.PG_FILE_INITIAL_PATH, "C:\\Program Files\\Internet Explorer") pg.SetPropertyAttribute("Date", wxpg.PG_DATE_PICKER_STYLE, wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) pg.Append(wxpg.PropertyCategory("5 - Custom Properties")) pg.Append(IntProperty2("IntProperty2", value=1024)) pg.Append( RectProperty("RectProperty", value=wx.Rect(100, 200, 300, 400))) pg.Append(ShapeProperty("ShapeProperty", value=0)) pg.Append(PyObjectProperty("PyObjectProperty")) prop = pg.Append( wxpg.StringProperty("StringWithCustomEditor", value="test value")) pg.SetPropertyEditor(prop, "TrivialPropertyEditor") pg.Append(wxpg.ImageFileProperty("ImageFileWithLargeEditor")) pg.SetPropertyEditor("ImageFileWithLargeEditor", "LargeImageEditor") # When page is added, it will become the target page for AutoFill # calls (and for other property insertion methods as well) pg.AddPage("Page 2 - Results of AutoFill will appear here") pg.SetPropertyClientData("Point", 1234) if pg.GetPropertyClientData("Point") != 1234: raise ValueError("Set/GetPropertyClientData() failed") # Test setting unicode string pg.GetPropertyByName("String").SetValue(u"Some Unicode Text") # # Test some code that *should* fail (but not crash) try: a_ = pg.GetPropertyValue("NotARealProperty") pg.EnableProperty("NotAtAllRealProperty", False) pg.SetPropertyHelpString("AgaintNotARealProperty", "Dummy Help String") except: pass #raise topsizer.Add(pg, 1, wx.EXPAND) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(self, -1, "SetPropertyValues") but.Bind(wx.EVT_BUTTON, self.OnSetPropertyValues) rowsizer.Add(but, 1) but = wx.Button(self, -1, "GetPropertyValues") but.Bind(wx.EVT_BUTTON, self.OnGetPropertyValues) rowsizer.Add(but, 1) topsizer.Add(rowsizer, 0, wx.EXPAND) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(self, -1, "GetPropertyValues(as_strings=True)") but.Bind(wx.EVT_BUTTON, self.OnGetPropertyValues2) rowsizer.Add(but, 1) but = wx.Button(self, -1, "AutoFill") but.Bind(wx.EVT_BUTTON, self.OnAutoFill) rowsizer.Add(but, 1) topsizer.Add(rowsizer, 0, wx.EXPAND) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(self, -1, "Delete") but.Bind(wx.EVT_BUTTON, self.OnDeleteProperty) rowsizer.Add(but, 1) but = wx.Button(self, -1, "Run Tests") but.Bind(wx.EVT_BUTTON, self.RunTests) rowsizer.Add(but, 1) topsizer.Add(rowsizer, 0, wx.EXPAND) self.SetSizer(topsizer) topsizer.SetSizeHints(self)
def createPropetyGrid(self, book): # Difference between using PropertyGridManager vs PropertyGrid is that # the manager supports multiple pages and a description box. self.pg = wxpg.PropertyGridManager(self.panel, style=wxpg.PG_SPLITTER_AUTO_CENTER | # wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) # Show help as tooltips # pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) self.pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange) self.pg.Bind(wxpg.EVT_PG_PAGE_CHANGED, self.OnPropGridPageChange) self.pg.Bind(wxpg.EVT_PG_SELECTED, self.OnPropGridSelect) self.pg.Bind(wxpg.EVT_PG_RIGHT_CLICK, self.OnPropGridRightClick) # # Let's use some simple custom editor # # NOTE: Editor must be registered *before* adding a property that # uses it. if not getattr(sys, '_PropGridEditorsRegistered', False): self.pg.RegisterEditor(TrivialPropertyEditor) self.pg.RegisterEditor(SampleMultiButtonEditor) self.pg.RegisterEditor(LargeImageEditor) # ensure we only do it once sys._PropGridEditorsRegistered = True # # Add properties # self.pg.AddPage("Page 1 - Testing All") self.pg.Append(wxpg.PropertyCategory("1 - Basic Properties")) self.pg.Append(wxpg.StringProperty("Book name", value=book.bookName)) # self.pg.Append(wxpg.StringProperty("Book description", value=str(book.bookDescription or ''))) authorNames = list() if hasattr(book, 'authors'): for a in book.authors: authorNames.append(a.authorName) self.pg.Append(wxpg.StringProperty("Author(s) name", value=','.join(authorNames))) self.pg.Append(wxpg.StringProperty("Number of pages", value=str(book.numberOfPages or ''))) self.pg.Append(wxpg.IntProperty("Rating", value=long(book.rating or 0))) self.pg.SetPropertyEditor("Rating", "SpinCtrl") self.pg.Append(wxpg.EditEnumProperty("Tag", "EditEnumProperty", ['Physis', 'B', 'C'], [0, 1, 2], "Text Not in List")) try: self.pg.Append(wxpg.StringProperty("Publisher", value=str(book.publisher or ''))) except: pass self.pg.Append(wxpg.StringProperty("ISBN", value=str(book.isbn_13 or ''))) self.pg.Append(wxpg.StringProperty("Language", value=str(book.inLanguage or ''))) self.pg.Append(wxpg.PropertyCategory("2 - More Properties")) self.pg.Append(wxpg.IntProperty("id", value=book.id)) self.pg.Append(wxpg.DirProperty("File location", value=book.bookPath)) self.pg.Append(wxpg.StringProperty("File size", value=str(book.fileSize or ''))) self.pg.Append(wxpg.LongStringProperty("MultipleButtons")); self.pg.SetPropertyEditor("MultipleButtons", "SampleMultiButtonEditor"); imgPath = os.path.join(book.bookPath, book.bookImgName) self.pg.Append(wxpg.ImageFileProperty(label="Book image", value=imgPath)) # self.pg.Append(wxpg.DateProperty("Published date", value=self.pydate2wxdate(book.publishedOn))) return self.pg
def __init__(self, parent): gui_metasimulator.MainFrame.__init__(self, parent) serialcore.SerialMixin.__init__(self) # The base GUI code is auto-generated using wxFormBuilder, which is # unable to generate code for the PropertyGrid. This means that we # have to do it here. pg = wxpg.PropertyGridManager(self, style=wxpg.PG_SPLITTER_AUTO_CENTER) self.m_pg.ContainingSizer.Replace(self.m_pg, pg) self.m_pg.Destroy() self.m_pg = pg self.m_pg.AddPage("Watch state") self.Layout() # The GUIMetaProtocolParser is strongly coupled to this class and # contains all reactions to incoming messages, like changing a # PropertyGrid entry or showing an indicator. self.parser = protocol_handlers.GUIMetaProtocolParser(self) self.factory = protocol_handlers.GUIMetaProtocolFactory(self) # Nice colorization for log messages in the main window. There are # definitely better ways to do this, like implementing a custom # handler, but this works fine as well. class TBStream(object): @staticmethod def write(bytes): if "[ERROR]" in bytes: color = "red" elif "[DEBUG]" in bytes: color = "gray" elif "[WARNING]" in bytes: color = "blue" else: color = "black" self.m_log.SetDefaultStyle(wx.TextAttr(color, "white")) self.m_log.AppendText(bytes) streamhandler = logging.StreamHandler(stream=TBStream) streamhandler.formatter = logging.Formatter("[%(levelname)s] - %(name)s " "-> %(message)s") self.log_window_handler = streamhandler logging.root.addHandler(streamhandler) # Shortcut for NVAL access class NVALAccess(object): def __init__(self, pg): self.pg = pg def __getitem__(self, item): return self.pg.GetPropertyValue(item) def __setitem__(self, item, value): return self.pg.SetPropertyValue(item, value) self.nval_store = NVALAccess(self.m_pg) # The SerialMixin emits a signal every time it receives a chunk of bytes. self.Bind(serialcore.EVT_SERIALRX, self.OnSerialRX) logging.info("GUI initialized") self.logger = logging.getLogger("main") # The config parser reads configuration values from a settings file. # At the moment, this is only the most recent COM port. try: self.config = json.load(open(INI_FILE)) except (IOError, ValueError): self.config = {} last_com_port = self.config.get('LastPort', 'COM1') # The serial class will be accessed from the serialcore.SerialMixin. try: self.serial = serial.Serial(last_com_port) except serial.SerialException: self.serial = serial.Serial() self.serial.close() self.serial.timeout = 0.5 self.m_comPort.Value = self.serial.port or 'None' # The real time clock is updated by a regular timer event. self.clock = wx.Timer(self) self.clock.Start(500) self.Bind(wx.EVT_TIMER, self.OnClock) for btn in ['B', 'C', 'D', 'E', 'F']: button = getattr(self, 'm_Side'+btn) button.Bind(wx.EVT_LEFT_UP, self.OnSideButtonUp ) button.Bind(wx.EVT_LEFT_DOWN, self.OnSideButtonDown) self.btn_time = {} self.m_resetWatchOnButtonClick(None) if self.serial.port: self.m_openConnectionOnButtonClick() if len(sys.argv) > 1: if sys.argv[1] == '--debug': self.m_debug.Value = True streamhandler.setLevel(logging.DEBUG)
def __init__(self, parent, plot): wx.Panel.__init__(self, parent, wx.ID_ANY) sizer = wx.BoxSizer(wx.VERTICAL) self.plot = plot self.pg = pg = wxpg.PropertyGridManager( self, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT | wxpg.PG_TOOLBAR) # Show help as tooltips pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) # Bind events pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange) pg.Bind(wxpg.EVT_PG_RIGHT_CLICK, self.OnPropGridRightClick) # Parse the properties to insert into the propertygrid for property_category_index, property_category in enumerate( INPUT_DATA['PropertyCategory']): pg.Append( wxpg.PropertyCategory( '%s - %s' % (property_category_index + 1, property_category['title']))) format_string = ( str(property_category_index + 1) + '.%0' + str(len(str(len(property_category['properties']) + 1))) + 'd') for prop_index, prop in enumerate(property_category['properties']): self.append(format_string % (prop_index + 1), prop) # pg.Append(wxpg.PropertyCategory("2 - Plot Type")) # projection_names = sorted([PROJECTIONS[proj]['name'] # for proj in PROJECTIONS]) # proj = 'Cylindrical Equidistant' # pg.Append(SingleChoiceProperty("Projection", # choices=projection_names, # value=proj)) self.pp = pg.Append(wxpg.PropertyCategory("3 - Projection Parameters")) self.pp_list = [] pg.Append(wxpg.PropertyCategory("4 - Plot Properties")) pg.Append(wxpg.BoolProperty("Blue Marble", value=True)) pg.Append(wxpg.BoolProperty("Coastlines", value=False)) pg.Append(wxpg.BoolProperty("State Borders", value=False)) pg.Append(wxpg.BoolProperty("Country Borders", value=False)) pg.Append(wxpg.FloatProperty("Area Threshold", value=10000)) # pg.Append(SingleChoiceProperty("Resolution", choices=RESOLUTION_KEYS, # value='Crude')) # Do Layout sizer.Add(pg, 1, wx.EXPAND) rowsizer = wx.BoxSizer(wx.HORIZONTAL) but = wx.Button(self, -1, "Update Plot") but.Bind(wx.EVT_BUTTON, self.OnUpdatePlotButtonEvent) rowsizer.Add(but, 1) sizer.Add(rowsizer, 0, wx.EXPAND) self.SetSizer(sizer) self.SetAutoLayout(True) self.OnUpdatePlotButtonEvent()