def DoLayout(self): frameSizer = wx.BoxSizer(wx.VERTICAL) mainSizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) colourSizer = wx.FlexGridSizer(4, 4, 1, 10) label1 = wx.StaticText(self.mainPanel, -1, "Welcome to the GradientButton demo for wxPython!") mainSizer.Add(label1, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 10) mainSizer.Add(self.btn1, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, 15) btnSizer.Add(self.btn2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) btnSizer.Add((20, 0)) firstStrings = ["Top Start", "Bottom Start", "Pressed Top", "Text Colour"] secondStrings = ["Top End", "Bottom End", "Pressed Bottom", ""] for strings in firstStrings: label = wx.StaticText(self.mainPanel, -1, strings) colourSizer.Add(label, 0, wx.ALIGN_CENTER|wx.EXPAND) for strings in firstStrings: colourSizer.Add(self.FindWindowByName(strings), 0, wx.ALIGN_CENTER|wx.BOTTOM|wx.EXPAND, 10) for strings in secondStrings: label = wx.StaticText(self.mainPanel, -1, strings) colourSizer.Add(label, 0, wx.ALIGN_CENTER|wx.EXPAND) for strings in secondStrings[:-1]: colourSizer.Add(self.FindWindowByName(strings), 0, wx.ALIGN_CENTER|wx.EXPAND, 10) btnSizer.Add(colourSizer, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL) btnSizer.Add((10, 0)) mainSizer.Add(btnSizer, 0, wx.EXPAND|wx.ALL, 10) boldFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) boldFont.SetWeight(wx.BOLD) for child in self.mainPanel.GetChildren(): if isinstance(child, wx.StaticText): child.SetFont(boldFont) buttonFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) buttonFont.SetWeight(wx.BOLD) try: buttonFont.SetFaceName("Tahoma") self.btn1.SetFont(buttonFont) self.btn2.SetFont(buttonFont) except: self.btn1.SetFont(boldFont) self.btn2.SetFont(boldFont) self.mainPanel.SetSizer(mainSizer) mainSizer.Layout() frameSizer.Add(self.mainPanel, 1, wx.EXPAND) self.SetSizer(frameSizer) frameSizer.Layout()
def loadList(self): if self.type == wx.LC_REPORT: try: # get system font width fw = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT).GetPointSize()+1 except: fw = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()+1 self.InsertColumn(0, self.utility.lang.get('name'), format=wx.LIST_FORMAT_CENTER, width=fw*6) self.updateAll() self.Show(True)
def InitFont(self): """ Initalizes the fonts for :class:`SuperToolTip`. """ self._messageFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) self._headerFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) self._headerFont.SetWeight(wx.BOLD) self._footerFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) self._footerFont.SetWeight(wx.BOLD) self._hyperlinkFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) self._hyperlinkFont.SetWeight(wx.BOLD) self._hyperlinkFont.SetUnderlined(True)
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) try: font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) boldfont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) except AttributeError: # wxPython 4 / Phoenix updated SystemSettings font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) boldfont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) self.il = ULC.PyImageList(20, 20) self.il.Add(image.task_process.getBitmap()) self.il.Add(image.task_start.getBitmap()) self.il.Add(image.task_waiting.getBitmap()) self.il.Add(image.task_done.getBitmap()) self.ulc = ULC.UltimateListCtrl(self, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES) self.ulc.SetImageList(self.il, wx.IMAGE_LIST_SMALL) self.Bind(ULC.EVT_LIST_ITEM_HYPERLINK, self.OnHyperTextClicked, self.ulc) self.Bind(ULC.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.ulc) # 参考资料 # http://xoomer.virgilio.it/infinity77/Phoenix/lib.agw.ultimatelistctrl.UltimateListItem.html#lib.agw.ultimatelistctrl.UltimateListItem # 设置第一列的样式 # 创建一个ULC list item info = ULC.UltimateListItem() # mask可以出现哪些形式的 info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT info._format = ULC.ULC_FORMAT_LEFT info._text = LANG.finished self.ulc.InsertColumnInfo(0, info) info = ULC.UltimateListItem() info._format = ULC.ULC_FORMAT_LEFT info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT | ULC.ULC_MASK_HYPERTEXT self.ulc.InsertColumnInfo(1, info) self.ulc.SetColumnWidth(0, 600) self.ulc.SetColumnWidth(1, 200) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.ulc, 1, flag=wx.EXPAND) self.SetSizer(sizer)
def __init__(self, controller, *args, **kwargs): """ Describe the main UI and font settings. """ logging.debug(u"Initializing main UI") title = _("autorandr-gui") self.controller = controller wx.Frame.__init__(self, *args, title=title, **kwargs) self.font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) self.font.SetPointSize(int(1.2 * float(self.font.GetPointSize()))) self.font.SetWeight(wx.FONTWEIGHT_BOLD) self.italfont = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) self.italfont.SetPointSize( int(0.8 * float(self.italfont.GetPointSize()))) #self.italfont.SetStyle(wx.FONTSTYLE_ITALIC) self.__toolbar() self.__vertbox()
def __init__(self, parent, docs): super(DocListBox, self).__init__(parent) self.docs = docs """ @type : Document """ self.SetItemCount(len(docs)) self.labelFont = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) self.labelFont.SetPointSize(10) self.labelFont.SetFaceName(FILENAME_FONT) self.commentFont = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) self.commentFont.SetPointSize(9) self.commentFont.SetFaceName(COMMENT_FONT)
def __init__(self, input="", width=hypertreelist._DEFAULT_COL_WIDTH, flag=wx.ALIGN_LEFT, image=-1, shown=True, colour=None, edit=False): if type(input) in (type(""), type(u"")): self._text = input self._width = width self._flag = flag self._image = image self._selected_image = -1 self._shown = shown self._edit = edit self._font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) if colour is None: self._colour = wx.SystemSettings_GetColour( wx.SYS_COLOUR_WINDOWTEXT) else: self._text = input._text self._width = input._width self._flag = input._flag self._image = input._image self._selected_image = input._selected_image self._shown = input._shown self._edit = input._edit self._colour = input._colour self._font = input._font
def updateReportList(self): self.SetWindowStyleFlag(self.type) if not hasattr(self, 'fw'): try: # get system font width self.fw = wx.SystemSettings_GetFont( wx.SYS_DEFAULT_GUI_FONT).GetPointSize() + 1 except: self.fw = wx.SystemSettings_GetFont( wx.SYS_SYSTEM_FONT).GetPointSize() + 1 self.InsertColumn(0, self.utility.lang.get('name'), format=wx.LIST_FORMAT_CENTER, width=self.fw * 20) self.loadList()
def __init__(self, parent, title): """ Default class constructor. :param `parent`: the :class:`FMTitlePanel` parent; :param `title`: the string to use as a dialog title. """ wx.Panel.__init__(self, parent) self._title = title # Set the panel size dc = wx.MemoryDC() dc.SelectObject(wx.EmptyBitmap(1, 1)) dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)) ww, hh = dc.GetTextExtent("Tp") dc.SelectObject(wx.NullBitmap) # Set minimum panel size if ww < 250: ww = 250 self.SetSize(wx.Size(ww, hh + 10)) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
def OnPaint(self, evt): """Paint the display and its values""" if wx.Platform == "__WXMSW__": dc = wx.BufferedPaintDC(self) brush = wx.Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENU), wx.SOLID) dc.SetBackground(brush) dc.Clear() else: dc = wx.PaintDC(self) gc = wx.GCDC(dc) rect = self.GetRect() w = rect.width h = rect.height gc.SetBrush(wx.Brush(DISP_COLOR)) color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVEBORDER) color = AdjustColour(color, -30) gc.SetPen(wx.Pen(color, 2)) gc.DrawRoundedRectangle(1, 1, w - 2, h - 2, 5) font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) gc.SetPen(wx.BLACK_PEN) self._DrawText(gc, rect, font) evt.Skip()
def show(self, parent): import wx newFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) newFont.SetPointSize(25) dlg = wx.Dialog(parent, title=self.title, style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP) sizer = wx.BoxSizer(wx.VERTICAL) dlg.SetSizer(sizer) message = wx.StaticText(dlg, label=self.message) message.SetFont(newFont) sizer.Add(message, 1, wx.EXPAND | wx.ALL, 10) ok = wx.Button(dlg, wx.ID_OK, "OK") ok.SetDefault() sizer.Add(ok, 0, wx.ALIGN_CENTER | wx.ALL, 10) dlg.Fit() size = dlg.GetSize() size.IncBy(100, 100) dlg.SetSize(size) dlg.Centre() ##wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) dlg.ShowModal() dlg.Destroy()
def define_help_panel(self, info): font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(9) bmp_kill = wx.ArtProvider.GetBitmap(wx.ART_DELETE, wx.ART_TOOLBAR, (15, 15)) panel_help = wx.Panel(self, -1) st = wx.StaticText(panel_help, label=info) st.SetFont(font) st.SetForegroundColour('brown') # wx.BORDER_NONE only works for BitmapButton btn_kill = wx.BitmapButton(panel_help, id=wx.ID_ANY, bitmap=bmp_kill, size=(bmp_kill.GetWidth(), bmp_kill.GetHeight()), style=wx.BORDER_NONE) vbox_help = wx.BoxSizer(wx.HORIZONTAL) vbox_help.Add(st, proportion=1, flag=wx.EXPAND) vbox_help.Add(btn_kill, proportion=0, flag=wx.EXPAND | wx.ALIGN_RIGHT) panel_help.SetSizer(vbox_help) return panel_help
def displayError(self, bitmap, offset=(0, 0)): """ Shows an error message saying the video device was not found. Accepts bitmap as wx.Bitmap and position. Optimized for 128x128. """ #FIXME: (Minor) a bit of flicker on the error message. if self._error > 2: #Only redraw if needed. self.Unbind(wx.EVT_IDLE) self.Unbind(wx.EVT_LEFT_UP) #just in case self.Bind(wx.EVT_LEFT_UP, self.onClick) return 0 boldfont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) boldfont.SetWeight(wx.BOLD) boldfont.SetPointSize(16) dc = wx.ClientDC(self) dc.Clear() pencolour = wx.Colour(180, 0, 0, wx.ALPHA_OPAQUE) brushcolour = wx.Colour(180, 0, 0, wx.ALPHA_OPAQUE) dc.SetPen(wx.Pen(pencolour)) dc.SetBrush(wx.Brush(brushcolour)) rect = wx.Rect(0, 0, 450, 200) rect.SetPosition((100, 100)) dc.DrawRoundedRectangleRect(rect, 8) message = 'Unable to open video device.\nIs there one connected?\n\n' \ 'Click here to retry.' dc.SetTextForeground('white') dc.DrawText(message, 280, 170) dc.SetFont(boldfont) dc.DrawText('Error', 280, 140) dc.DrawBitmap(bitmap, offset[0], offset[1], False) self._error += 1
def __init__(self, max): style = wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX wx.Frame.__init__(self, None, -1, 'Downloading', size=(350, 150), style=style) panel = wx.Panel(self) self.count = 0 self.max = max self.gauge = wx.Gauge(panel, -1, self.max, size=(250, 25)) self.gauge.SetBezelFace(3) self.gauge.SetShadowWidth(3) font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(8) self.label = wx.StaticText(panel, label='Downloading') self.label.SetFont(font) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.label, flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5) vbox.Add(self.gauge, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5) panel.SetSizer(vbox) self.Refresh()
def __init__(self, serPort, cfg, gpios, adcs, dacs): wx.Frame.__init__(self, None, -1, "Quick Controller") self.panel = wx.Panel(self) self.txtFields = [] self.config = cfg try: self.BoardComm = TransLayer(serPort, cfg.getVref(), cfg.getRes()) time.sleep(1) except IOError: wx.MessageBox("Could not open serial port %s" % serPort, style=wx.ICON_EXCLAMATION) self.Close() wx.Exit() self.ctlDic = {'gpio': {}, 'adc': {}, 'dac': {}} gpiobox = self.MakeGpioCluster(gpios) adcbox = self.MakeAdcCluster(adcs) dacbox = self.MakeDacCluster(dacs) sizer = wx.BoxSizer(wx.VERTICAL) # add the controls only if required if gpiobox != None: sizer.Add(gpiobox, 0, wx.ALL, 10) if adcbox != None: sizer.Add(adcbox, 0, wx.ALL, 10) if dacbox != None: sizer.Add(dacbox, 0, wx.ALL, 10) self.statusBar = self.CreateStatusBar() font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(10) self.panel.SetSizer(sizer) sizer.Fit(self)
def __set_properties(self): self.SetTitle('Gaussian Fitting for Cross-Scan Observation') self.SetSize((1280, 720)) #self.SetSize((1920, 1080)) self.CB_SCAN.SetValue(False) self.CB_DATE.SetValue(False) self.LB_SCANS.SetMinSize((340, 100)) self.FS = wx.SystemSettings_GetFont( wx.SYS_OEM_FIXED_FONT).GetPointSize() self.Font = wx.Font(self.FS, wx.MODERN, wx.NORMAL, wx.NORMAL, False) self.LB_SCANS.SetFont(self.Font) self.BT_EXIT.SetBackgroundColour(wx.Colour(255, 0, 0)) self.fits_path = self.TC_FITS.GetValue() self.fit_path = self.TC_FIT.GetValue() self.tele_name = 'NSRT' self.diam = 26.0 self.obs_lon = 87.178108 self.obs_lat = 43.4709389 self.freq = 4800.0 self.tcal = 1.0 self.flag = True self.beam = 1.12 * 3600 * 300 * 180 / np.pi / self.freq / self.diam self.doff = self.beam * 0.15 self.dwidth = 0.1 self.rerr = 0.1 self.dsymm = 0.1 self.davg = 0.15
def __init__(self, parent, columns, selectCommand, editCommand, dragAndDropCommand, editSubjectCommand, itemPopupMenu=None, columnPopupMenu=None, *args, **kwargs): self.__adapter = parent self.__selection = [] self.__dontStartEditingLabelBecauseUserDoubleClicked = False self.__defaultFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) kwargs.setdefault('resizeableColumn', 0) super(TreeListCtrl, self).__init__(parent, style=self.getStyle(), agwStyle=self.getAgwStyle(), columns=columns, itemPopupMenu=itemPopupMenu, columnPopupMenu=columnPopupMenu, *args, **kwargs) self.bindEventHandlers(selectCommand, editCommand, dragAndDropCommand, editSubjectCommand)
def populate_editor(self): font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(9) # Display a name field definitions = [{ "type": "string", "label": "Block name", "help": "Name for the configuration block.", "name": "name" }] # Display a name field box1 = self.create_fields(definitions) # No matter what create the common fields box2 = self.create_fields(self.schema['COMMON']) # Then display the extra fields depending on the type box3 = self.create_fields(self.schema[self.type]) # main vertial box vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(box1, flag=wx.EXPAND) vbox.Add(box2, flag=wx.EXPAND) vbox.Add(box3, flag=wx.EXPAND) self.SetSizer(vbox) self.SetAutoLayout(True) self.SetupScrolling() # If we are editing global default -> make name it readonly if self.fields['name'].GetValue() in ['LOCAL', 'HPC']: self.fields['name'].SetEditable(False) self.fields['name'].SetBackgroundColour('grey')
def __init__(self, parent, timeout, *args, **kwargs): """ Describe the timeout dialog. """ logging.debug( u"Opening a new timeout dialog box with a duration of {0} secs.". format(timeout)) TIMER_ID = 100 self.timeout = timeout super(TimeoutDialog, self).__init__(parent=parent, \ title=_("The display settings have changed")) vbox = wx.BoxSizer(wx.VERTICAL) font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(int(1.2 * float(font.GetPointSize()))) font.SetWeight(wx.FONTWEIGHT_BOLD) self.title = wx.StaticText( self, label=_("Are the display settings applied correctly?")) self.title.SetFont(font) self.text = wx.StaticText(self) self.__SetLabelText() btns = self.CreateButtonSizer(wx.YES | wx.NO | wx.NO_DEFAULT) vbox.Add(self.title, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.TOP, border=30) vbox.Add(self.text, proportion=1, flag=wx.LEFT | wx.RIGHT, border=30) vbox.Add(btns, proportion=1, flag=wx.ALL | wx.ALIGN_CENTER, border=15) self.SetSizerAndFit(vbox) self.Bind(wx.EVT_BUTTON, self.OnNo, id=wx.ID_NO) self.Bind(wx.EVT_BUTTON, self.OnYes, id=wx.ID_YES) """ Add a Timer """ self.tim = wx.Timer(self, TIMER_ID) self.tim.Start(1000) wx.EVT_TIMER(self, TIMER_ID, self.OnTimer)
def __init__(self, parent, id_=wx.ID_ANY, default=wx.NullFont): """Initializes the PyFontPicker @param default: The font to initialize as selected in the control """ wx.Panel.__init__(self, parent, id_, style=wx.NO_BORDER) # Attributes if default == wx.NullFont: self._font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) else: self._font = default self._text = wx.StaticText(self) self._text.SetFont(default) self._text.SetLabel(u"%s - %dpt" % (self._font.GetFaceName(), \ self._font.GetPointSize())) self._button = wx.Button(self, label=_("Set Font") + u'...') # Layout vsizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddStretchSpacer() sizer.Add(self._text, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.Add(self._button, 0, wx.ALIGN_CENTER_VERTICAL) vsizer.AddMany([((1, 1), 0), (sizer, 0, wx.EXPAND), ((1, 1), 0)]) self.SetSizer(vsizer) self.SetAutoLayout(True) # Event Handlers self.Bind(wx.EVT_BUTTON, lambda evt: self.ShowFontDlg(), self._button) self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnChange)
def __init__( self, *args, **kwargs ): BasePanel.__init__( self, *args, **kwargs ) self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) ) self.hidden = False self._margin = 5 # Add the label self.label = wx.StaticText( self, -1, self.prop.GetLabel() ) if self.prop.IsCategory(): labelfont = wx.SystemSettings_GetFont( wx.SYS_DEFAULT_GUI_FONT ) labelfont.SetWeight( wx.BOLD ) self.label.SetFont( labelfont ) # Button and label go in seperate sizer self.sizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.sizer2.PrependSpacer( 16, -1 ) self.sizer2.Add( self.label, 1, wx.EXPAND ) self.sizer.Add( self.sizer2, 1, wx.EXPAND ) # Create the control ctrl = self.prop.BuildControl( self ) if ctrl is not None: self.sizer2.Add( ctrl, 4, wx.RIGHT, 5 ) self.Collapse()
def __init__(self, parent, id, title): font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(14) wx.Frame.__init__(self, parent, id, title, size=(500, 600), style=wx.CAPTION) panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) question = wx.StaticText( panel, label= 'Please describe in detail the strategy you used to make your choices.' ) question.SetFont(font) vbox.Add(question, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border=15) self.answer = wx.TextCtrl(panel, style=wx.TE_MULTILINE) self.answer.SetFont(font) vbox.Add(self.answer, 10, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=15) button = wx.Button(panel, 1, 'Send', (80, 220)) vbox.Add(button, 1, wx.ALIGN_CENTER, border=15) self.Bind(wx.EVT_BUTTON, self.OnClose, id=1) panel.SetSizer(vbox) self.Centre()
def _createFontPicker(self, currentFont, currentColor): defaultFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) picker = widgets.FontPickerCtrl(self, font=currentFont or defaultFont, colour=currentColor) picker.Bind(wx.EVT_FONTPICKER_CHANGED, self.onFontPicked) return picker
def __init__(self, font=None): if font is None: defaultFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) font = wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, False, defaultFont.FaceName) super(TriageRenderer, self).__init__() self.font = font
def __init__(self, parent, conf_file='conf.txt', id=-1, title='', pos=wx.Point(0, 0), size=wx.Size(530, 520), style=wx.DEFAULT_DIALOG_STYLE, name='dialogBox'): #pre=wx.PreDialog() self.OnPreCreate() try: self.conf = ConfigHandler(conf_file) except IOError: wx.MessageBox("Could not find the config file, %s" % conf_file) self.__del__() sys.exit(1) board = self.conf.getBoard() wx.Frame.__init__( self, parent, id, title + ' ' + board, pos, size, wx.CAPTION | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CLOSE_BOX | wx.MINIMIZE_BOX, name) self.statusBar = self.CreateStatusBar() font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(10) self.initBefore() self.VwXinit() self.initAfter()
def __init__(self, parent, id): wx.Frame.__init__(self, None, title="Warning!!", size=(1080, 720)) panel = MainPanel(self) vbox = wx.BoxSizer(wx.VERTICAL) vbox = wx.BoxSizer(wx.VERTICAL) st = wx.StaticText(panel, label='Do you want to give up REST ???', size=(1080, 60)) font1 = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) font1.SetPointSize(45) st.SetFont(font1) vbox.Add(st, flag=wx.RIGHT, border=2) hbox3 = wx.BoxSizer(wx.HORIZONTAL) buttonYes = wx.Button(panel, label="Yes", size=(150, 40)) buttonNo = wx.Button(panel, label="No", size=(150, 40)) hbox3.Add(buttonYes) hbox3.Add(buttonNo) vbox.Add(hbox3, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border=10) buttonYes.Bind(wx.EVT_BUTTON, self.update_give_up) buttonNo.Bind(wx.EVT_BUTTON, self.quit) panel.SetSizer(vbox)
def ok(self): for section, setting, checkBox in self._booleanSettings: self.setboolean(section, setting, checkBox.IsChecked()) for section, setting, choiceCtrls in self._choiceSettings: value = '_'.join([ choice.GetClientData(choice.GetSelection()) for choice in choiceCtrls ]) self.settext(section, setting, value) for section, setting, multipleChoice, choices in self._multipleChoiceSettings: self.setlist(section, setting, [ choices[index] for index in range(len(choices)) if multipleChoice.IsChecked(index) ]) for section, setting, spin in self._integerSettings: self.setint(section, setting, spin.GetValue()) for section, setting, timeCtrl in self._timeSettings: self.setint(section, setting, timeCtrl.GetValue()) for section, setting, colorButton in self._colorSettings: self.setvalue(section, setting, colorButton.GetColour()) for section, setting, fontButton in self._fontSettings: selectedFont = fontButton.GetSelectedFont() defaultFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) fontInfoDesc = '' if selectedFont == defaultFont else selectedFont.GetNativeFontInfoDesc( ) self.settext(section, setting, fontInfoDesc) for section, setting, iconEntry in self._iconSettings: iconName = iconEntry.GetClientData(iconEntry.GetSelection()) self.settext(section, setting, iconName) for section, setting, btn in self._pathSettings: self.settext(section, setting, btn.GetPath()) for section, setting, txt in self._textSettings: self.settext(section, setting, txt.GetValue())
def __init__(self, parent, id, style, tabname, tabno, objects, pkgdir): if platform == 'win32': style |= wx.ALWAYS_SHOW_SB # fails on GTK wx.VListBox.__init__(self, parent, id, style=style) self.font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) if platform.startswith('linux'): self.font.SetPointSize(10) # Default is too big on Linux self.SetFont(self.font) (x, self.height) = self.GetTextExtent("Mq") if platform.startswith('linux'): self.height -= 1 self.imgs = parent.imgs self.actfg = platform == 'darwin' and wx.Colour( 255, 255, 255) or wx.SystemSettings_GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT) self.inafg = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT) self.indent = 4 self.parent = parent self.tabname = tabname self.tabno = tabno self.pkgdir = pkgdir self.populate(objects) wx.EVT_LISTBOX(self, self.GetId(), self.parent.OnChoice) wx.EVT_KEY_DOWN(self, self.parent.palette.OnKeyDown) wx.EVT_SET_FOCUS(self, self.parent.palette.OnSetFocus) self.SetDropTarget(PaletteDropTarget(self.parent.palette))
def get_system_fontsize(): font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) if font.IsUsingSizeInPixels(): fontsize = font.GetPixelSize() else: fontsize = font.GetPointSize() return fontsize
def __init__(self, parent): wx.ListCtrl.__init__(self, parent, wx.NewIdRef(), style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SORT_ASCENDING) CheckListCtrlMixin.__init__(self) ListCtrlAutoWidthMixin.__init__(self) self.InsertColumn(0, _('Name'), width=140) self.InsertColumn(1, _('Size [Ko]'), width=80) self.InsertColumn(2, _('Repository'), width=90) self.InsertColumn(3, _('Path'), width=100) ### for itemData self.map = {} if wx.VERSION_STRING < '4.0': self.SetStringItem = self.SetStringItem self.InsertStringItem = self.InsertStringItem font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT) else: self.SetStringItem = self.SetItem self.InsertStringItem = self.InsertItem font = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT) self.SetFont(font)