def _newEventList(self, parent): tree = TreeListCtrl(parent, -1, style=wx.TR_HIDE_ROOT | wx.TR_NO_BUTTONS | wx.TR_ROW_LINES | wx.TR_FULL_ROW_HIGHLIGHT) self._initEventList(tree) return tree
def __init__(self, *args, **kwds): # begin wxGlade: wxITI1480AMainFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_OPEN, "&Open", "Open file", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.ID_SAVE, "&Save", "Save current capture", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_EXIT, "&Exit", "", wx.ITEM_NORMAL) self.menubar.Append(wxglade_tmp_menu, "&File") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(4, "&Start", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(5, "&Pause", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(wx.ID_STOP, "S&top", "", wx.ITEM_NORMAL) self.menubar.Append(wxglade_tmp_menu, "&Capture") self.SetMenuBar(self.menubar) # Menu Bar end self.statusbar = self.CreateStatusBar(3, 0) # Tool Bar self.toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.TB_FLAT | wx.TB_DOCKABLE | wx.TB_TEXT) self.SetToolBar(self.toolbar) self.toolbar.AddLabelTool(wx.ID_OPEN, "Open", wx.Bitmap("images/fileopen.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "Open file", "") self.toolbar.AddLabelTool(wx.ID_SAVE, "Save", wx.Bitmap("images/filesave.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "Save current capture", "") self.toolbar.AddSeparator() self.toolbar.AddLabelTool(4, "Start", wx.Bitmap("images/player_play.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "Start cature", "") self.toolbar.AddLabelTool(5, "Pause", wx.Bitmap("images/player_pause.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_CHECK, "Pause/continue capture", "") self.toolbar.AddLabelTool(wx.ID_STOP, "Stop", wx.Bitmap("images/player_stop.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "Terminate capture", "") # Tool Bar end self.device_notebook = wx.Notebook(self, -1, style=0) self.capture_list = TreeListCtrl(self.device_notebook, -1, style=wx.TR_HIDE_ROOT | wx.TR_NO_BUTTONS | wx.TR_ROW_LINES | wx.TR_FULL_ROW_HIGHLIGHT) self.bus_list = TreeListCtrl(self.device_notebook, -1, style=wx.TR_HIDE_ROOT | wx.TR_NO_BUTTONS | wx.TR_ROW_LINES | wx.TR_FULL_ROW_HIGHLIGHT) self.error_list = TreeListCtrl(self.device_notebook, -1, style=wx.TR_HIDE_ROOT | wx.TR_NO_BUTTONS | wx.TR_ROW_LINES | wx.TR_FULL_ROW_HIGHLIGHT) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.onOpen, id=wx.ID_OPEN) self.Bind(wx.EVT_MENU, self.onSave, id=wx.ID_SAVE) self.Bind(wx.EVT_MENU, self.onExit, id=wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.onStart, id=4) self.Bind(wx.EVT_MENU, self.onPause, id=5) self.Bind(wx.EVT_MENU, self.onStop, id=wx.ID_STOP)
def __init__(self, parent, ID, title,size=wx.Size(450,300),callback=None): wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition, size=size) self.callback = callback self.Center() self.SetTitle(title) self.SetIcon(icons.getAGIconIcon()) self.serviceManagers = [] self.nodeServiceHandle = None self.app = Toolkit.Application.instance() menuBar = wx.MenuBar() ## FILE menu self.fileMenu = wx.Menu() self.fileMenu.Append(ID_FILE_ATTACH, "Connect to Node...", "Connect to a NodeService") self.fileMenu.AppendSeparator() self.fileMenu.Append(ID_FILE_LOAD_CONFIG, "Load Configuration...", "Load a NodeService Configuration") self.fileMenu.Append(ID_FILE_STORE_CONFIG, "Store Configuration...", "Store a NodeService Configuration") self.fileMenu.AppendSeparator() self.fileMenu.Append(ID_FILE_EXIT, "E&xit", "Terminate the program") menuBar.Append(self.fileMenu, "&File"); ## SERVICE MANAGERS menu self.serviceManagersMenu = BuildServiceManagerMenu() menuBar.Append(self.serviceManagersMenu, "&ServiceManager"); ## SERVICE menu self.serviceMenu = BuildServiceMenu() menuBar.Append(self.serviceMenu, "&Service"); ## HELP menu self.helpMenu = wx.Menu() self.helpMenu.Append(ID_HELP_ABOUT, "&About", "More information about this program") menuBar.Append(self.helpMenu, "&Help"); self.SetMenuBar(menuBar) self.tree = TreeListCtrl(self,-1, style = wx.TR_MULTIPLE|wx.TR_HIDE_ROOT|wx.TR_TWIST_BUTTONS) self.tree.AddColumn("Name") self.tree.AddColumn("Resource") self.tree.AddColumn("Status") self.tree.SetMainColumn(0) self.tree.SetColumnWidth(0,175) self.tree.SetColumnWidth(1,175) self.tree.SetColumnWidth(2,90) wx.EVT_TREE_ITEM_RIGHT_CLICK(self, self.tree.GetId(), self.PopupThatMenu) wx.EVT_TREE_ITEM_ACTIVATED(self, self.tree.GetId(), self.DoubleClickCB ) wx.InitAllImageHandlers() imageSize = 22 imageList = wx.ImageList(imageSize,imageSize) bm = icons.getComputerBitmap() self.smImage = imageList.Add(bm) bm = icons.getDefaultServiceBitmap() self.svcImage = imageList.Add(bm) self.tree.SetImageList(imageList) self.imageList = imageList # Create the status bar self.CreateStatusBar(2) self.SetStatusText("Not Connected",1) # Associate menu items with callbacks wx.EVT_MENU(self, ID_FILE_ATTACH , self.Attach ) wx.EVT_MENU(self, ID_FILE_EXIT , self.TimeToQuit ) wx.EVT_MENU(self, ID_FILE_LOAD_CONFIG , self.LoadConfiguration ) wx.EVT_MENU(self, ID_FILE_STORE_CONFIG , self.StoreConfiguration ) wx.EVT_MENU(self, ID_HELP_ABOUT , self.OnAbout) wx.EVT_MENU(self, ID_HOST_ADD , self.AddHost ) wx.EVT_MENU(self, ID_HOST_REMOVE , self.RemoveServiceManager ) wx.EVT_MENU(self, ID_SERVICE_ADD_SERVICE , self.AddService ) wx.EVT_MENU(self, ID_SERVICE_CONFIGURE , self.ConfigureService ) wx.EVT_MENU(self, ID_SERVICE_REMOVE , self.RemoveService ) wx.EVT_MENU(self, ID_SERVICE_ENABLE , self.EnableServices ) wx.EVT_MENU(self, ID_SERVICE_ENABLE_ONE , self.EnableService ) wx.EVT_MENU(self, ID_SERVICE_DISABLE , self.DisableServices ) wx.EVT_MENU(self, ID_SERVICE_DISABLE_ONE , self.DisableService ) wx.EVT_TREE_KEY_DOWN(self.tree, self.tree.GetId(), self.OnKeyDown) self.menuBar = menuBar self.EnableMenus(False) self.recentNodeServiceList = [] self.recentServiceManagerList = []