X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a4c013b2b1c033e33da3f3bdfe03ab4f91eaf5c1..b843b628c9f936d6a87ca1e9b91e88a4604270c4:/wxPython/wx/tools/XRCed/params.py diff --git a/wxPython/wx/tools/XRCed/params.py b/wxPython/wx/tools/XRCed/params.py index d15bf69641..ef153502b4 100644 --- a/wxPython/wx/tools/XRCed/params.py +++ b/wxPython/wx/tools/XRCed/params.py @@ -10,11 +10,20 @@ from globals import * from types import * from wxPython.xrc import * -genericStyles = ['wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', - 'wxSUNKEN_BORDER', 'wxRAISED_BORDER', - 'wxSTATIC_BORDER', 'wxNO_BORDER', - 'wxTRANSPARENT_WINDOW', 'wxWANTS_CHARS', - 'wxNO_FULL_REPAINT_ON_RESIZE'] +genericStyles = [ + 'wxCLIP_CHILDREN', + 'wxSIMPLE_BORDER', + 'wxSUNKEN_BORDER', + 'wxDOUBLE_BORDER', + 'wxRAISED_BORDER', + 'wxSTATIC_BORDER', + 'wxNO_BORDER', + 'wxTRANSPARENT_WINDOW', + 'wxWANTS_CHARS', + 'wxNO_FULL_REPAINT_ON_RESIZE', + 'wxFULL_REPAINT_ON_RESIZE', + 'wxWS_EX_BLOCK_EVENTS', +] buttonSize = (35,-1) # in dialog units, transformed to pixels in panel ctor @@ -22,6 +31,8 @@ buttonSize = (35,-1) # in dialog units, transformed to pixels in panel ctor class PPanel(wxPanel): def __init__(self, parent, name): wxPanel.__init__(self, parent, -1, name=name) + self.SetBackgroundColour(parent.GetBackgroundColour()) + self.SetForegroundColour(parent.GetForegroundColour()) self.modified = self.freeze = False def Enable(self, value): # Something strange is going on with enable so we make sure... @@ -42,7 +53,6 @@ class ParamBinaryOr(PPanel): PPanel.__init__(self, parent, name) self.ID_TEXT_CTRL = wxNewId() self.ID_BUTTON_CHOICES = wxNewId() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer = wxBoxSizer() self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1)) sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5) @@ -93,8 +103,10 @@ 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'] + 'wxALIGN_CENTRE_HORIZONTAL', + ] equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE', 'wxALIGN_CENTER_VERTICAL': 'wxALIGN_CENTRE_VERTICAL', 'wxALIGN_CENTER_HORIZONTAL': 'wxALIGN_CENTRE_HORIZONTAL'} @@ -125,7 +137,6 @@ class ParamColour(PPanel): PPanel.__init__(self, parent, name) self.ID_TEXT_CTRL = wxNewId() self.ID_BUTTON = wxNewId() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer = wxBoxSizer() self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(65,-1)) sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5) @@ -154,7 +165,7 @@ class ParamColour(PPanel): if self.IsEnabled(): dc.SetPen(wxBLACK_PEN) else: dc.SetPen(wxGREY_PEN) size = self.button.GetSize() - dc.DrawRectangle((0, 0), size) + dc.DrawRectangle(0, 0, size.width, size.height) def OnLeftDown(self, evt): data = wxColourData() data.SetColour(self.GetValue()) @@ -185,7 +196,6 @@ class ParamFont(PPanel): PPanel.__init__(self, parent, name) self.ID_TEXT_CTRL = wxNewId() self.ID_BUTTON_SELECT = wxNewId() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer = wxBoxSizer() self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(200,-1)) sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5) @@ -279,7 +289,6 @@ class ParamInt(PPanel): self.ID_SPIN_CTRL = wxNewId() sizer = wxBoxSizer() self.spin = wxSpinCtrl(self, self.ID_SPIN_CTRL, size=(50,-1)) - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer.Add(self.spin) self.SetAutoLayout(True) self.SetSizer(sizer) @@ -303,7 +312,6 @@ class ParamUnit(PPanel): self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(35,-1)) self.spin = wxSpinButton(self, self.ID_SPIN_BUTTON, style = wxSP_VERTICAL, size=(-1,1)) self.spin.SetRange(-10000, 10000) - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer.Add(self.text, 0, wxEXPAND | wxRIGHT, 2) sizer.Add(self.spin, 0, wxEXPAND) self.SetAutoLayout(True) @@ -343,9 +351,7 @@ class ParamMultilineText(PPanel): PPanel.__init__(self, parent, name) self.ID_TEXT_CTRL = wxNewId() self.ID_BUTTON_EDIT = wxNewId() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer = wxBoxSizer() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1)) sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5) self.button = wxButton(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize) @@ -376,7 +382,6 @@ class ParamText(PPanel): self.ID_TEXT_CTRL = wxNewId() # We use sizer even here to have the same size of text control sizer = wxBoxSizer() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(textWidth,-1)) if textWidth == -1: option = 1 else: option = 0 @@ -411,10 +416,10 @@ class ParamEncoding(ParamText): class ContentDialog(wxDialog): def __init__(self, parent, value): # Load from resource - pre = wxPreDialog() + pre = wxPreDialog() g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT') self.this = pre.this - self._setOORInfo(self) + self._setOORInfo(self) self.list = XRCCTRL(self, 'LIST') # Set list items for v in value: @@ -461,10 +466,10 @@ class ContentDialog(wxDialog): class ContentCheckListDialog(wxDialog): def __init__(self, parent, value): - pre = wxPreDialog() + pre = wxPreDialog() g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECK_LIST') self.this = pre.this - self._setOORInfo(self) + self._setOORInfo(self) self.list = XRCCTRL(self, 'CHECK_LIST') # Set list items i = 0 @@ -523,7 +528,6 @@ class ParamContent(PPanel): PPanel.__init__(self, parent, name) self.ID_TEXT_CTRL = wxNewId() self.ID_BUTTON_EDIT = wxNewId() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer = wxBoxSizer() self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1)) sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5) @@ -594,10 +598,10 @@ class ParamContentCheckList(ParamContent): class IntListDialog(wxDialog): def __init__(self, parent, value): - pre = wxPreDialog() + pre = wxPreDialog() g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_INTLIST') self.this = pre.this - self._setOORInfo(self) + self._setOORInfo(self) self.list = XRCCTRL(self, 'LIST') # Set list items value.sort() @@ -666,7 +670,6 @@ class RadioBox(PPanel): def __init__(self, parent, id, choices, pos=wxDefaultPosition, name='radiobox'): PPanel.__init__(self, parent, name) - self.SetBackgroundColour(g.panel.GetBackgroundColour()) self.choices = choices topSizer = wxBoxSizer() for i in choices: @@ -712,12 +715,22 @@ class ParamOrient(RadioBox): if not value: value = 'wxHORIZONTAL' self.SetStringSelection(self.seulav[value]) +class ParamOrientation(RadioBox): + values = {'horizontal': 'horizontal', 'vertical': 'vertical'} + seulav = {'horizontal': 'horizontal', 'vertical': 'vertical'} + def __init__(self, parent, name): + RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name) + def GetValue(self): + return self.values[self.GetStringSelection()] + def SetValue(self, value): + if not value: value = 'vertical' + self.SetStringSelection(self.seulav[value]) + class ParamFile(PPanel): def __init__(self, parent, name): PPanel.__init__(self, parent, name) self.ID_TEXT_CTRL = wxNewId() self.ID_BUTTON_BROWSE = wxNewId() - self.SetBackgroundColour(g.panel.GetBackgroundColour()) sizer = wxBoxSizer() self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1)) sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5) @@ -761,14 +774,19 @@ class ParamFile(PPanel): class ParamBitmap(PPanel): def __init__(self, parent, name): - pre = wxPrePanel() + pre = wxPrePanel() g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP') self.this = pre.this - self._setOORInfo(self) + self._setOORInfo(self) + self.SetBackgroundColour(parent.GetBackgroundColour()) + self.SetForegroundColour(parent.GetForegroundColour()) self.modified = self.freeze = False - self.SetBackgroundColour(g.panel.GetBackgroundColour()) self.radio_std = XRCCTRL(self, 'RADIO_STD') + self.radio_std.SetBackgroundColour(parent.GetBackgroundColour()) + self.radio_std.SetForegroundColour(parent.GetForegroundColour()) self.radio_file = XRCCTRL(self, 'RADIO_FILE') + self.radio_file.SetBackgroundColour(parent.GetBackgroundColour()) + self.radio_file.SetForegroundColour(parent.GetForegroundColour()) self.combo = XRCCTRL(self, 'COMBO_STD') self.text = XRCCTRL(self, 'TEXT_FILE') self.button = XRCCTRL(self, 'BUTTON_BROWSE') @@ -843,6 +861,7 @@ paramDict = { 'flag': ParamFlag, 'style': ParamStyle, 'exstyle': ParamExStyle, 'pos': ParamPosSize, 'size': ParamPosSize, + 'cellpos': ParamPosSize, 'cellspan': ParamPosSize, 'border': ParamUnit, 'cols': ParamInt, 'rows': ParamInt, 'vgap': ParamUnit, 'hgap': ParamUnit, 'checkable': ParamBool, 'checked': ParamBool, 'radio': ParamBool,