def __init__(self, parent, title): wx.Frame.__init__(self, parent=parent, id=-1, title=title, size=(800, 600)) self.CenterOnScreen() images.initialize() _icon = wx.EmptyIcon() _icon.CopyFromBitmap(images.GetBitmap("AppIcon")) self.SetIcon(_icon) tbicon = wx.TaskBarIcon() tbicon.SetIcon(_icon) self.sp = wx.SplitterWindow(self) self.tree = workspaceview.WorkspaceView(self.sp) if DEBUG: w_path = os.path.abspath(workspace_path) self.SetLabel(workspace_path) self.tree.SetModel(workspacemodel.WorkspaceModel(w_path)) self.nb = TabsView(self.sp) tmodel = tabsmodel.TabsModel(self.tree.GetModel()) # TODO: tmodel._path = w_path # !!! self.nb.SetModel(tmodel) self.tree.SetTabsModel(tmodel) self.sp.SetMinimumPaneSize(10) self.sp.SplitVertically(self.tree, self.nb, 200)
def GetIcon(type): if type == "Context": return images.GetBitmap("Context") elif type == "Many-valued context": return images.GetBitmap("MVContext") elif type == "Scale": return images.GetBitmap("Scale") elif type == "Text": return images.GetBitmap("Text") elif type == "Concepts": return images.GetBitmap("ConceptLattice") elif type == "Image": return images.GetBitmap("Image") elif type == "Folder": return (images.GetBitmap("HDir"), images.GetBitmap("OpenHDir")) else: return images.GetBitmap("Unknown")
def CreateToolBar(self): tb = wx.ToolBar(self) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(tb, 0, wx.EXPAND) sizer.Add(self.canvas, 1, wx.EXPAND) self.SetSizer(sizer) tool = tb.AddLabelTool(wx.NewId(), "Save", images.GetBitmap("Save"), shortHelp="Save image") self.Bind(wx.EVT_TOOL, self.OnSave, tool) tool = tb.AddLabelTool(wx.NewId(), "Objects", images.GetBitmap("Dummy"), shortHelp="Toggle extent label view") self.Bind(wx.EVT_TOOL, self.OnToggleExtentView, tool) tool = tb.AddLabelTool(wx.NewId(), "Attributes", images.GetBitmap("Dummy"), shortHelp="Toggle intent label view") self.Bind(wx.EVT_TOOL, self.OnToggleIntentView, tool) tool = tb.AddLabelTool(wx.NewId(), "Increase font size", images.GetBitmap("Plus"), shortHelp="Increase font size") self.Bind(wx.EVT_TOOL, self.OnIncreaseFontSize, tool) tool = tb.AddLabelTool(wx.NewId(), "Decrease font size", images.GetBitmap("Minus"), shortHelp="Decrease font size") self.Bind(wx.EVT_TOOL, self.OnDecreaseFontSize, tool) tool = tb.AddLabelTool(wx.NewId(), "Print", images.GetBitmap("Dummy"), shortHelp="Print") self.Bind(wx.EVT_TOOL, self.canvas.OnPrint, tool) tool = tb.AddLabelTool(wx.NewId(), "Store coordinates", images.GetBitmap("Dummy"), shortHelp="Store coordinates") self.Bind(wx.EVT_TOOL, self.OnSaveXML, tool) return tb
def CreateToolBar(self): tb = wx.ToolBar(self) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(tb, 0, wx.EXPAND) sizer.Add(self.grid, 1, wx.EXPAND) self.SetSizer(sizer) tool = tb.AddLabelTool(wx.NewId(), "Save", images.GetBitmap("Save"), shortHelp="Save current file") self.Bind(wx.EVT_TOOL, self.OnSave, tool) tool = tb.AddLabelTool(wx.NewId(), "Save as...", images.GetBitmap("SaveAs"), shortHelp="Save current file as...") self.Bind(wx.EVT_TOOL, self.OnSaveAs, tool) tb.AddSeparator() tool = tb.AddLabelTool(wx.NewId(), "Add Object", images.GetBitmap("AddRow"), shortHelp="Add object") self.Bind(wx.EVT_TOOL, self.OnAddRow, tool) tool = tb.AddLabelTool(wx.NewId(), "Add Attribute", images.GetBitmap("AddColumn"), shortHelp="Add Attribute") self.Bind(wx.EVT_TOOL, self.OnAddColumn, tool) tool = tb.AddLabelTool(wx.NewId(), "Delete Object", images.GetBitmap("DeleteRow"), shortHelp="Delete Object") self.Bind(wx.EVT_TOOL, self.OnDeleteRow, tool) tool = tb.AddLabelTool(wx.NewId(), "Delete Attribute", images.GetBitmap("DeleteColumn"), shortHelp="Delete Attribute") self.Bind(wx.EVT_TOOL, self.OnDeleteColumn, tool) return tb
def LoadImages(self): self.eofMarker = images.GetBitmap(images.EofImageData)