X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c032d94e606dae4cd9712a02eb7bf6e2f42dcf51..1d88e73a3f25f16ad845b114153edd603d4970be:/wxPython/wx/tools/XRCed/params.py diff --git a/wxPython/wx/tools/XRCed/params.py b/wxPython/wx/tools/XRCed/params.py index 5ba1bccd68..442c9c2257 100644 --- a/wxPython/wx/tools/XRCed/params.py +++ b/wxPython/wx/tools/XRCed/params.py @@ -11,14 +11,10 @@ from types import * from wxPython.xrc import * genericStyles = [ - 'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER', + 'wxSIMPLE_BORDER', 'wxSUNKEN_BORDER', 'wxDOUBLE_BORDER', 'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER', - 'wxTRANSPARENT_WINDOW', 'wxTAB_TRAVERSAL', - 'wxWANTS_CHARS', - 'wxNO_FULL_REPAINT_ON_RESIZE', - 'wxVSCROLL', 'wxHSCROLL', 'wxALWAYS_SHOW_SB', - 'wxCLIP_CHILDREN', - 'wxFULL_REPAINT_ON_RESIZE' + 'wxCLIP_CHILDREN', 'wxTRANSPARENT_WINDOW', 'wxWANTS_CHARS', + 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_REPAINT_ON_RESIZE' ] genericExStyles = [ @@ -41,7 +37,7 @@ class PPanel(wxPanel): # Something strange is going on with enable so we make sure... for w in self.GetChildren(): w.Enable(value) - wxPanel.Enable(self, value) + #wxPanel.Enable(self, value) def SetModified(self): self.modified = True g.panel.SetModified(True) @@ -108,14 +104,17 @@ class ParamBinaryOr(PPanel): class ParamFlag(ParamBinaryOr): values = ['wxTOP', 'wxBOTTOM', 'wxLEFT', 'wxRIGHT', 'wxALL', - 'wxEXPAND', 'wxGROW', 'wxSHAPED', 'wxALIGN_CENTRE', 'wxALIGN_RIGHT', - 'wxFIXED_MINSIZE', - 'wxALIGN_BOTTOM', 'wxALIGN_CENTRE_VERTICAL', - 'wxALIGN_CENTRE_HORIZONTAL', + 'wxEXPAND', 'wxGROW', 'wxSHAPED', 'wxSTRETCH_NOT', + 'wxALIGN_CENTRE', 'wxALIGN_LEFT', 'wxALIGN_RIGHT', + 'wxALIGN_TOP', 'wxALIGN_BOTTOM', + 'wxALIGN_CENTRE_VERTICAL', 'wxALIGN_CENTRE_HORIZONTAL', + 'wxADJUST_MINSIZE', 'wxFIXED_MINSIZE' ] equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE', 'wxALIGN_CENTER_VERTICAL': 'wxALIGN_CENTRE_VERTICAL', - 'wxALIGN_CENTER_HORIZONTAL': 'wxALIGN_CENTRE_HORIZONTAL'} + 'wxALIGN_CENTER_HORIZONTAL': 'wxALIGN_CENTRE_HORIZONTAL', + 'wxUP': 'wxTOP', 'wxDOWN': 'wxBOTTOM', 'wxNORTH': 'wxTOP', + 'wxSOUTH': 'wxBOTTOM', 'wxWEST': 'wxLEFT', 'wxEAST': 'wxRIGHT'} def __init__(self, parent, name): ParamBinaryOr.__init__(self, parent, name) @@ -188,7 +187,6 @@ class ParamExStyle(ParamBinaryOr): else: self.values = [] ParamBinaryOr.__init__(self, parent, name) - self.SetTitle('Extended window styles') class ParamColour(PPanel): def __init__(self, parent, name): @@ -196,10 +194,10 @@ class ParamColour(PPanel): self.ID_TEXT_CTRL = wxNewId() self.ID_BUTTON = wxNewId() sizer = wxBoxSizer() - self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(65,-1)) - sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5) - self.button = wxPanel(self, self.ID_BUTTON, wxDefaultPosition, wxSize(20, 1)) - sizer.Add(self.button, 0, wxGROW | wxALIGN_CENTER_VERTICAL) + self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(80,-1)) + sizer.Add(self.text, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 2) + self.button = wxPanel(self, self.ID_BUTTON, wxDefaultPosition, wxSize(20, 20)) + sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) @@ -213,8 +211,11 @@ class ParamColour(PPanel): self.freeze = True if not value: value = '#FFFFFF' self.text.SetValue(str(value)) # update text ctrl - colour = wxColour(int(value[1:3], 16), int(value[3:5], 16), int(value[5:7], 16)) - self.button.SetBackgroundColour(colour) + try: + colour = wxColour(int(value[1:3], 16), int(value[3:5], 16), int(value[5:7], 16)) + self.button.SetBackgroundColour(colour) + except: # ignore errors + pass self.button.Refresh() self.freeze = False def OnPaintButton(self, evt): @@ -235,7 +236,7 @@ class ParamColour(PPanel): ################################################################################ -# Mapping from wx constants ro XML strings +# Mapping from wx constants to XML strings fontFamiliesWx2Xml = {wxDEFAULT: 'default', wxDECORATIVE: 'decorative', wxROMAN: 'roman', wxSCRIPT: 'script', wxSWISS: 'swiss', wxMODERN: 'modern'} @@ -269,7 +270,7 @@ class ParamFont(PPanel): PPanel.OnChange(self, evt) self.textModified = True def _defaultValue(self): - return ['12', 'default', 'normal', 'normal', '0', '', ''] + return [`g._sysFont.GetPointSize()`, 'default', 'normal', 'normal', '0', '', ''] def GetValue(self): if self.textModified: # text has newer value try: @@ -293,7 +294,7 @@ class ParamFont(PPanel): self.value = self._defaultValue() # Make initial font # Default values - size = 12 + size = g._sysFont.GetPointSize() family = wxDEFAULT style = weight = wxNORMAL underlined = 0 @@ -472,7 +473,7 @@ class ParamText(PPanel): self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(textWidth,-1)) if textWidth == -1: option = 1 else: option = 0 - sizer.Add(self.text, option, wxALIGN_CENTER_VERTICAL) + sizer.Add(self.text, option, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 2) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) @@ -951,5 +952,5 @@ paramDict = { 'fg': ParamColour, 'bg': ParamColour, 'font': ParamFont, 'enabled': ParamBool, 'focused': ParamBool, 'hidden': ParamBool, 'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap, - 'encoding': ParamEncoding + 'encoding': ParamEncoding, 'borders': ParamUnit }