X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68ae5821b6b27a9aef780619aa31851cf4f3616f..3d2d9036037d9ee51f47d878c3dcef4af4a6ef41:/wxPython/wx/tools/XRCed/params.py?ds=sidebyside diff --git a/wxPython/wx/tools/XRCed/params.py b/wxPython/wx/tools/XRCed/params.py index 49b0f86606..2c3e02d278 100644 --- a/wxPython/wx/tools/XRCed/params.py +++ b/wxPython/wx/tools/XRCed/params.py @@ -10,11 +10,25 @@ 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 = [ + 'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_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' + ] + +genericExStyles = [ + 'wxWS_EX_VALIDATE_RECURSIVELY', + 'wxWS_EX_BLOCK_EVENTS', + 'wxWS_EX_TRANSIENT', + 'wxFRAME_EX_CONTEXTHELP', + 'wxWS_EX_PROCESS_IDLE', + 'wxWS_EX_PROCESS_UI_UPDATES' + ] buttonSize = (35,-1) # in dialog units, transformed to pixels in panel ctor @@ -118,7 +132,7 @@ class ParamNonGenericStyle(ParamBinaryOr): class ParamExStyle(ParamBinaryOr): def __init__(self, parent, name): if g.currentXXX: - self.values = g.currentXXX.exStyles # constant at the moment + self.values = g.currentXXX.exStyles + genericExStyles else: self.values = [] ParamBinaryOr.__init__(self, parent, name) @@ -236,20 +250,21 @@ class ParamFont(PPanel): error = False try: try: size = int(self.value[0]) - except ValueError: error = True + except ValueError: error = True; wxLogError('Invalid size specification') try: family = fontFamiliesXml2wx[self.value[1]] - except KeyError: error = True + except KeyError: error = True; wxLogError('Invalid family specification') try: style = fontStylesXml2wx[self.value[2]] - except KeyError: error = True + except KeyError: error = True; wxLogError('Invalid style specification') try: weight = fontWeightsXml2wx[self.value[3]] - except KeyError: error = True - try: underlined = int(self.value[4]) - except ValueError: error = True + except KeyError: error = True; wxLogError('Invalid weight specification') + try: underlined = bool(self.value[4]) + except ValueError: error = True; wxLogError('Invalid underlined flag specification') face = self.value[5] - mapper = wxFontMapper() - if not self.value[6]: enc = mapper.CharsetToEncoding(self.value[6]) except IndexError: error = True + mapper = wxFontMapper() + if not self.value[6]: enc = mapper.CharsetToEncoding(self.value[6]) + if error: wxLogError('Invalid font specification') if enc == wxFONTENCODING_DEFAULT: enc = wxFONTENCODING_SYSTEM font = wxFont(size, family, style, weight, underlined, face, enc) @@ -258,13 +273,18 @@ class ParamFont(PPanel): dlg = wxFontDialog(self, data) if dlg.ShowModal() == wxID_OK: font = dlg.GetFontData().GetChosenFont() + print font.GetEncoding() + if font.GetEncoding() == wxFONTENCODING_SYSTEM: + encName = '' + else: + encName = wxFontMapper_GetEncodingName(font.GetEncoding()).encode() value = [str(font.GetPointSize()), fontFamiliesWx2Xml.get(font.GetFamily(), "default"), fontStylesWx2Xml.get(font.GetStyle(), "normal"), fontWeightsWx2Xml.get(font.GetWeight(), "normal"), - str(font.GetUnderlined()), + str(int(font.GetUnderlined())), font.GetFaceName().encode(), - wxFontMapper_GetEncodingName(font.GetEncoding()).encode() + encName ] # Add ignored flags self.SetValue(value) @@ -407,10 +427,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: @@ -457,10 +477,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 @@ -589,10 +609,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() @@ -765,10 +785,10 @@ 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 @@ -852,6 +872,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,