def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) # Create the InfoBar. It starts out in a hidden state so it # won't be visible until we need it. self.info = IB.InfoBar(self) panel = wx.Panel(self) self.message = wx.TextCtrl(panel, -1, "Hello World", size=(250, -1)) self.flags = wx.Choice(panel, choices=[f[1] for f in flags]) self.flags.SetSelection(1) # wx.ICON_INFORMATION is the default self.checkBitmap = wx.CheckBox(panel, -1, 'With Bitmap') smBtn = wx.Button(panel, -1, "Show Message") dmBtn = wx.Button(panel, -1, "Dismiss") addBtn = wx.Button(panel, -1, "Add Button") fgs = wx.FlexGridSizer(cols=3, vgap=10, hgap=10) fgs.Add(wx.StaticText(panel, -1, "Message:"), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) fgs.Add(self.message) fgs.Add(self.flags) fgs.AddSpacer(5) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(smBtn, 0, wx.RIGHT, 5) hbox.Add(dmBtn) fgs.Add(hbox) fgs.AddSpacer(5) fgs.AddSpacer(5) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox2.Add(addBtn, 0, wx.RIGHT, 10) hbox2.Add(self.checkBitmap, 0, wx.ALIGN_CENTER) fgs.Add(hbox2) panel.Sizer = wx.BoxSizer(wx.VERTICAL) text = """\ An info bar is a transient window shown at top or bottom of its parent window to display non-critical information to the user.""" panel.Sizer.Add(wx.StaticText(panel, -1, text), 0, wx.TOP | wx.LEFT, 25) panel.Sizer.Add(fgs, 1, wx.EXPAND | wx.ALL, 25) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.info, 0, wx.EXPAND) self.Sizer.Add(panel, 1, wx.EXPAND) self.Bind(wx.EVT_BUTTON, self.OnShowMessage, smBtn) self.Bind(wx.EVT_BUTTON, self.OnDismiss, dmBtn) self.Bind(wx.EVT_BUTTON, self.OnAddButton, addBtn) self.valid_images = GetValidImages()
def __init__(self, parent, id=-1, size=wx.DefaultSize): scrolled.ScrolledPanel.__init__(self, parent, -1) #Placeholder for the imageCtrl creation self.mapImage = wx.Image(1, 1) self.imageCtrl = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(self.mapImage)) # self.maxWidth = 1000 # self.maxHeight = 1000 self.SetBackgroundColour("WHITE") # self.SetVirtualSize((self.maxWidth, self.maxHeight)) self.Bind(wx.EVT_SIZE, self.OnResize, self) font = wx.Font(16, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) self.info = IB.InfoBar(self) self.info.SetFont(font) self.info.SetBackgroundColour("#FFFF00") # Yeah, I know... _variable's are supposed to be private... but I wanted a color # with a little more contrast than the default... will wrap this in a try, just # in case it ever changes. try: self.info._text.SetBackgroundColour("#FFFF00") self.info._text.SetOwnForegroundColour("#000000") except: pass vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.info, 0, wx.EXPAND) vbox.Add(self.imageCtrl, 0, wx.ALL) self.SetSizer(vbox) self.SetupScrolling()
def __init__(self, parent, guiPlaces, model, **kw): global thePanel scrolled.ScrolledPanel.__init__(self, parent, style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER) self.usrDefinedNodeTypeCtrls = {} #? Set to True if you want to only show the config items, set to false if you want to show config and runtime items self.configOnly = True #? Set to the list of types that should not appear in the panel. The instance-identifier is not shown because it is constructed using the UML diagram self.noShowTypes = ["instance-identifier"] self.SetupScrolling(True, True) self.SetScrollRate(10, 10) self.model = model self.guiPlaces = guiPlaces self.lockedSvg = svg.SvgFile("locked.svg") self.unlockedSvg = svg.SvgFile("unlocked.svg") self.helpSvg = svg.SvgFile("help.svg") self.lockedBmp = self.lockedSvg.bmp((24, 24)) self.unlockedBmp = self.unlockedSvg.bmp((24, 24)) self.helpBmp = self.helpSvg.bmp((12, 12)) self.entity = None self.sizer = wx.BoxSizer(wx.VERTICAL) self.lookup = {} # find the object from its windowing ID self.numElements = 0 self.row = 0 self.font = wx.Font(10, wx.MODERN, wx.NORMAL, wx.BOLD) # Event handlers #self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_BUTTON, self.OnButtonClick) self.tree = None self.treeItemSelected = None # for the data entry # self.Bind(wx.EVT_TEXT, self.EvtText) self.isDetailInstance = kw.get("isDetailInstance", False) self.entityTreeTypes = [ "ServiceGroup", "Node", "ServiceUnit", "ServiceInstance" ] # Create the InfoBar to show error message self.info = IB.InfoBar(self) self.sizer.Add(self.info, 0, wx.EXPAND) # Creates hyperlisttree self.eventDictTree = { wx.EVT_TREE_ITEM_EXPANDED: self.OnTreeSelExpanded, wx.EVT_TREE_SEL_CHANGING: self.OnTreeSelChanged, wx.EVT_TREE_SEL_CHANGED: self.OnTreeSelChanged } self._createTreeEntities() if (self.isDetailInstance): share.instanceDetailsPanel = self else: share.detailsPanel = self if StandaloneDev: e = model.entities["app"] self.showEntity(e)