def __init__(self, parent, timeout=None, *args, **kwds): wxStatusB.__init__(self, parent, *args, **kwds) self.SetFieldsCount(1) self.timeout = timeout width, height = parent.GetSizeTuple() self.gauge = wx.Gauge(self, style=wx.GA_HORIZONTAL, size=(width, height/10)) rect = self.GetFieldRect(0) self.gauge.SetPosition((rect.x , rect.y )) if self.timeout is not None: self.gauge.SetRange(int(self.timeout)) self.timer = wx.Timer(self, -1) self.Bind(wx.EVT_TIMER, self._on_time, self.timer) self.timer.Start(1) self.pos = 0
def __init__(self, parent, timeout=None, *args, **kwds): wxStatusB.__init__(self, parent, *args, **kwds) self.SetFieldsCount(1) self.timeout = timeout width, height = parent.GetSizeTuple() self.gauge = wx.Gauge(self, style=wx.GA_HORIZONTAL, size=(width, height / 10)) rect = self.GetFieldRect(0) self.gauge.SetPosition((rect.x, rect.y)) if self.timeout is not None: self.gauge.SetRange(int(self.timeout)) self.timer = wx.Timer(self, -1) self.Bind(wx.EVT_TIMER, self._on_time, self.timer) self.timer.Start(1) self.pos = 0
def SetStatusText(self, text="", number=MSG_POSITION, event=None): """ Set the text that will be displayed in the status bar. """ wxStatusB.SetStatusText(self, text.split('\n', 1)[0], number) self.list_msg.append(text) self.status_color.SetBackgroundColour(GREEN) self.status_color.SetForegroundColour(GREEN) if self.frame is not None: self.frame.set_message(status=text, event=event)
def __init__(self, parent): StatusBar.__init__(self, parent) connect(self.update, signal='status_update', sender=Any) connect(self.clear, signal='status_clear', sender=Any)
def PushStatusText(self, *args, **kwds): """ PushStatusText """ text = "PushStatusText: What is this string?" wxStatusB.PushStatusText(self, field=MSG_POSITION, string=text)
def PopStatusText(self, *args, **kwds): """ Override status bar """ wxStatusB.PopStatusText(self, field=MSG_POSITION)
def __init__(self, parent, id): wxStatusB.__init__(self, parent, id) self.parent = parent self.parent.SetStatusBarPane(MSG_POSITION) #Layout of status bar width = STATUS_BAR_ICON_SIZE height = STATUS_BAR_ICON_SIZE self.SetFieldsCount(NB_FIELDS) # Leave some space for the resize handle in the last field console_btn_width = 80 self.SetStatusWidths([width + 4, -2, -1, width + console_btn_width]) self.SetMinHeight(height + 10) #display default message self.msg_position = MSG_POSITION # Create progress bar gauge_width = 5 * width self.gauge = wx.Gauge(self, size=(gauge_width, height), style=wx.GA_HORIZONTAL) self.gauge.Hide() # Create status bar icon reflecting the type of status # for the last message self.status_color = wx.StaticText(self, id=wx.NewId(), label=" ", size=wx.Size(15, 15)) self.status_color.SetBackgroundColour(GREEN) self.status_color.SetForegroundColour(GREEN) # Create the button used to show the console dialog self.console_button = wx.Button(self, wx.NewId(), "Console", size=(console_btn_width, -1)) font = self.console_button.GetFont() _, pixel_h = font.GetPixelSize() font.SetPixelSize(wx.Size(0, int(pixel_h * 0.9))) self.console_button.SetFont(font) self.console_button.SetToolTipString("History of status bar messages") self.console_button.Bind(wx.EVT_BUTTON, self._onMonitor, id=self.console_button.GetId()) self.reposition() ## Current progress value of the bar self.nb_start = 0 self.nb_progress = 0 self.nb_stop = 0 self.frame = None self.list_msg = [] self.frame = Console(parent=self) if hasattr(self.frame, "IsIconized"): if not self.frame.IsIconized(): try: icon = self.parent.GetIcon() self.frame.SetIcon(icon) except: try: FRAME_ICON = wx.Icon(GUIFRAME_ICON.FRAME_ICON_PATH, wx.BITMAP_TYPE_ICO) self.frame.SetIcon(FRAME_ICON) except: pass self.frame.set_multiple_messages(self.list_msg) self.frame.Hide() self.progress = 0 self.timer = wx.Timer(self, -1) self.timer_stop = wx.Timer(self, -1) self.thread = None self.Bind(wx.EVT_TIMER, self._on_time, self.timer) self.Bind(wx.EVT_TIMER, self._on_time_stop, self.timer_stop) self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_IDLE, self.on_idle)
def __init__(self, parent, dpi=(1, 1)): Frame.__init__(self, parent, id=ID_ANY, title=u" mHosts - v" + Settings.version(), pos=DefaultPosition, size=Size(700 * dpi[0], 500 * dpi[1]), style=DEFAULT_FRAME_STYLE | SYSTEM_MENU | TAB_TRAVERSAL) self.SetIcon(Icon(iconPath, BITMAP_TYPE_ICO)) self.SetSizeHints(Size(500 * dpi[0], 350 * dpi[1])) self.menuBar = MenuBar(0) self.menuFile = Menu() self.menuItemNew = MenuItem(self.menuFile, ID_ANY, u"新建(&N)", EmptyString, ITEM_NORMAL) self.menuItemImport = MenuItem(self.menuFile, ID_ANY, u"导入(&I)", EmptyString, ITEM_NORMAL) if sys.platform != "linux": self.menuItemImport.Enable(False) self.menuFile.Append(self.menuItemNew) self.menuFile.Append(self.menuItemImport) self.menuFile.AppendSeparator() self.menuItemExit = MenuItem(self.menuFile, ID_ANY, u"退出(&Q)", EmptyString, ITEM_NORMAL) self.menuFile.Append(self.menuItemExit) self.menuBar.Append(self.menuFile, u"文件(&F)") self.menuHelp = Menu() self.menuItemSettings = MenuItem(self.menuHelp, ID_ANY, u"首选项(&P)", EmptyString, ITEM_NORMAL) if sys.platform != "linux": self.menuItemSettings.Enable(False) self.menuHelp.Append(self.menuItemSettings) self.menuItemHelpDoc = MenuItem(self.menuHelp, ID_ANY, u"帮助文档(&D)", EmptyString, ITEM_NORMAL) self.menuHelp.Append(self.menuItemHelpDoc) self.menuItemCheckUpdate = MenuItem(self.menuHelp, ID_ANY, u"检查更新(&U)", EmptyString, ITEM_NORMAL) self.menuHelp.Append(self.menuItemCheckUpdate) self.menuItemAbout = MenuItem(self.menuHelp, ID_ANY, u"关于(&A)", EmptyString, ITEM_NORMAL) self.menuHelp.Append(self.menuItemAbout) self.menuBar.Append(self.menuHelp, u"帮助(&H)") self.SetMenuBar(self.menuBar) self.statusBar = StatusBar(self, ID_ANY, STB_SIZEGRIP) statusBarFont = Font(10, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL, False, EmptyString) self.statusBar.SetFont(statusBarFont) self.SetStatusBar(self.statusBar) bSizer1 = BoxSizer(HORIZONTAL) self.images = {} self.imageList = ImageList(width=12, height=12) iconList = GetIcons().items() for name, bitmap in iconList: self.images[name] = self.imageList.Add(bitmap) self.hostsTree = TreeCtrl(self, ID_ANY, Point(0, 0), Size(180 * dpi[0], -1), TR_DEFAULT_STYLE) self.hostsTree.SetImageList(self.imageList) bSizer1.Add(self.hostsTree, 0, EXPAND, 5) # self.hostsListView = CheckListBox(self, size=Size(size[0] / 9, -1)) # bSizer1.Add(self.hostsListView, 0, EXPAND, 5) # WARNING: wxPython code generation isn't supported for this widget yet. self.codeEditor = CodeView(self, dpi) bSizer1.Add(self.codeEditor, 1, EXPAND, 5) self.SetSizer(bSizer1) self.Layout() self.Centre(BOTH) # Connect Events self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemNew.GetId()) self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemExit.GetId()) self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemAbout.GetId()) self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemHelpDoc.GetId()) self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemSettings.GetId()) self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemImport.GetId()) self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemCheckUpdate.GetId())
def __init__(self, parent, id): wxStatusB.__init__(self, parent, id) self.parent = parent self.parent.SetStatusBarPane(MSG_POSITION) #Layout of status bar width = STATUS_BAR_ICON_SIZE height = STATUS_BAR_ICON_SIZE self.SetFieldsCount(NB_FIELDS) # Leave some space for the resize handle in the last field console_btn_width = 80 self.SetStatusWidths([width+4, -2, -1, width+console_btn_width]) self.SetMinHeight(height + 10) #display default message self.msg_position = MSG_POSITION # Create progress bar gauge_width = 5 * width self.gauge = wx.Gauge(self, size=(gauge_width, height), style=wx.GA_HORIZONTAL) self.gauge.Hide() # Create status bar icon reflecting the type of status # for the last message self.status_color = wx.StaticText(self, id=wx.NewId(), label=" ", size=wx.Size(15, 15)) self.status_color.SetBackgroundColour(GREEN) self.status_color.SetForegroundColour(GREEN) # Create the button used to show the console dialog self.console_button = wx.Button(self, wx.NewId(), "Console", size=(console_btn_width, -1)) font = self.console_button.GetFont() _, pixel_h = font.GetPixelSize() font.SetPixelSize(wx.Size(0, int(pixel_h*0.9))) self.console_button.SetFont(font) self.console_button.SetToolTipString("History of status bar messages") self.console_button.Bind(wx.EVT_BUTTON, self._onMonitor, id=self.console_button.GetId()) self.reposition() ## Current progress value of the bar self.nb_start = 0 self.nb_progress = 0 self.nb_stop = 0 self.frame = None self.list_msg = [] self.frame = Console(parent=self) if hasattr(self.frame, "IsIconized"): if not self.frame.IsIconized(): try: icon = self.parent.GetIcon() self.frame.SetIcon(icon) except: try: FRAME_ICON = wx.Icon(GUIFRAME_ICON.FRAME_ICON_PATH, wx.BITMAP_TYPE_ICO) self.frame.SetIcon(FRAME_ICON) except: pass self.frame.set_multiple_messages(self.list_msg) self.frame.Hide() self.progress = 0 self.timer = wx.Timer(self, -1) self.timer_stop = wx.Timer(self, -1) self.thread = None self.Bind(wx.EVT_TIMER, self._on_time, self.timer) self.Bind(wx.EVT_TIMER, self._on_time_stop, self.timer_stop) self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_IDLE, self.on_idle)