Merged the wxPy_newswig branch into the HEAD branch (main trunk)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
@@ -1,75 +0,0 @@
|
||||
0.0.7
|
||||
-----
|
||||
|
||||
Some command-line arguments.
|
||||
|
||||
"Test window" command and toolbar button.
|
||||
|
||||
New panel interphace (wxHTMLWindow is not used anymore).
|
||||
|
||||
Toggling between embedded and detached panel.
|
||||
|
||||
Cache for already used windows.
|
||||
|
||||
Current top-level control is bold, if test window shown.
|
||||
|
||||
Undo/redo broken.
|
||||
|
||||
CheckListBox does not work unless wxXRC source fixed (in both wxPytnon and
|
||||
wxWin):
|
||||
|
||||
contrib/src/xrc/xmlrsall.cpp
|
||||
45,46c45,46
|
||||
< AddHandler(new wxListCtrlXmlHandler);
|
||||
< #if CHECKLISTBOX
|
||||
---
|
||||
> AddHandler(new wxListCtrlXmlHandler);
|
||||
> #if wxUSE_CHECKLISTBOX
|
||||
|
||||
This is fixed in CVS.
|
||||
|
||||
0.0.6
|
||||
-----
|
||||
|
||||
Toolbar, bitmap, icon support (no display yet).
|
||||
|
||||
Changed parameter objects, added support for multiple parameters (like
|
||||
`growablecols').
|
||||
|
||||
Fixed double-clicking problem with tree control on Windows.
|
||||
|
||||
Some performance improovements.
|
||||
|
||||
|
||||
0.0.5
|
||||
-----
|
||||
|
||||
Added notebook with properties page and style page. Fixed some problems
|
||||
on Windows.
|
||||
|
||||
|
||||
0.0.4
|
||||
-----
|
||||
|
||||
Some fixes suggested by RD
|
||||
|
||||
|
||||
0.0.3
|
||||
-----
|
||||
|
||||
Faster preview window refresh.
|
||||
|
||||
Cut/Paste works better.
|
||||
|
||||
Some tree icons.
|
||||
|
||||
Tree item names.
|
||||
|
||||
Bugfixes.
|
||||
|
||||
|
||||
0.0.2
|
||||
-----
|
||||
|
||||
The first release.
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
0.1.1-4
|
||||
-------
|
||||
|
||||
Fixed problems with wxStaticBitmap (stock_id attribute, icon type
|
||||
switching).
|
||||
|
||||
Changed some dimensions in properties panel elements.
|
||||
|
||||
0.1.1-3
|
||||
-------
|
||||
|
||||
Sizes of some controls were not normal on wxMSW. Fixed.
|
||||
|
||||
Some changes to test window code to make it resize better and to
|
||||
have focus control with sawfish for all types of windows.
|
||||
|
||||
0.1.1-2
|
||||
-------
|
||||
|
||||
Bugs with currentEncoding and frame testing fixed.
|
||||
|
||||
Some required parameters are set to default if missing.
|
||||
|
||||
Unsupported classes are tolerated, with warning message.
|
||||
|
||||
wxScrolledWindow added (to 'control' pulldown menu, not yet to the
|
||||
tool palette).
|
||||
|
||||
Multi-line editing for labels and some values (wxTextCtrl,
|
||||
wxHtmlWindow).
|
||||
|
||||
0.1.1-1
|
||||
-------
|
||||
|
||||
Changed internationalization support. '-i' option removed, default
|
||||
encoding is used (should be defined in sitecustomize.py, or 'ascii' by
|
||||
default). When XRC file is opened with encoding specified,
|
||||
translations are not used.
|
||||
|
||||
0.1.1
|
||||
-----
|
||||
|
||||
Replace command added (not quite finished yet).
|
||||
|
||||
0.1.0
|
||||
-----
|
||||
|
||||
Finally implemented tools panel for almost all controls (except
|
||||
wxHtmlWindow, wxCalendarCtrl and wxGenericDirCtrl - they are too
|
||||
rarely used).
|
||||
|
||||
Changed some sizes in panel to better work with different fonts.
|
||||
|
||||
Fixed double-refreshing after Ctrl+R.
|
||||
|
||||
Maybe something else that I've forgot. It's been a looong day... :)
|
||||
|
||||
|
||||
0.0.9-6
|
||||
-------
|
||||
|
||||
Added dialog unit support.
|
||||
|
||||
Dealing with non-specified required values (set to defaults, if exist).
|
||||
|
||||
Added 'minsize' parameter of sizeritem.
|
||||
|
||||
Added '-i' option to turn off translations and use international characters.
|
||||
|
||||
0.0.9-5
|
||||
-------
|
||||
|
||||
Mac platform-specific checks.
|
||||
|
||||
0.0.9-4
|
||||
-------
|
||||
|
||||
Implemented standard bitmap selection.
|
||||
|
||||
Fixed a bug in FlexGridSizer code.
|
||||
|
||||
0.0.9-3
|
||||
-------
|
||||
|
||||
File browsing (for bitmaps/icons, etc.) had a small problem when current
|
||||
file was not saved yet.
|
||||
|
||||
0.0.9-2
|
||||
-------
|
||||
|
||||
Small bug fix for initial don't panic message.
|
||||
|
||||
0.0.9-1
|
||||
-------
|
||||
|
||||
Changed program structure, reduced use of global variables (grouped in
|
||||
module 'globals', which creates an instanse 'g' of class Globals.
|
||||
|
||||
First version of undo/redo working!
|
||||
|
||||
Support for toolbars inside panels and frames.
|
||||
|
||||
Added 'container' submenu for creating Panel, Notebook and ToolBar objects.
|
||||
|
||||
wxMSW-only: added code to switch focus back to main window when test
|
||||
window is updated.
|
||||
|
||||
0.0.8-2
|
||||
-------
|
||||
|
||||
Fixed unicode problem for unicode build.
|
||||
|
||||
0.0.8-1
|
||||
-------
|
||||
|
||||
Using WX_2_4_BRANCH.
|
||||
|
||||
Added new controls: wxSpinCtrl, wxGenericDirCtrl, unknown (custom
|
||||
control), improved wxXRC format suppor (menu styles, etc.).
|
||||
|
||||
Some I18N support: parsing "encoding" attribute in XML header, later
|
||||
it can be modified in "properties" panel for "XML tree".
|
||||
|
||||
UNIX note: currently XML writing for non-ascii chars works only if
|
||||
sys.getdefaultencoding() returns good value. To do this, one has to
|
||||
put following lines to "sitecustomize.py" file:
|
||||
|
||||
# Start code segment
|
||||
import sys
|
||||
sys.setdefaultencoding('iso-8859-1') # or whatever
|
||||
# End code segment
|
||||
|
||||
0.0.7
|
||||
-----
|
||||
|
||||
Some command-line arguments.
|
||||
|
||||
"Test window" command and toolbar button.
|
||||
|
||||
New panel interphace (wxHTMLWindow is not used anymore).
|
||||
|
||||
Toggling between embedded and detached panel.
|
||||
|
||||
Cache for already used windows.
|
||||
|
||||
Current top-level control is bold, if test window shown.
|
||||
|
||||
Undo/redo broken.
|
||||
|
||||
CheckListBox does not work unless wxXRC source fixed (in both wxPytnon and
|
||||
wxWin):
|
||||
|
||||
contrib/src/xrc/xmlrsall.cpp
|
||||
45,46c45,46
|
||||
< AddHandler(new wxListCtrlXmlHandler);
|
||||
< #if CHECKLISTBOX
|
||||
---
|
||||
> AddHandler(new wxListCtrlXmlHandler);
|
||||
> #if wxUSE_CHECKLISTBOX
|
||||
|
||||
This is fixed in CVS.
|
||||
|
||||
0.0.6
|
||||
-----
|
||||
|
||||
Toolbar, bitmap, icon support (no display yet).
|
||||
|
||||
Changed parameter objects, added support for multiple parameters (like
|
||||
`growablecols').
|
||||
|
||||
Fixed double-clicking problem with tree control on Windows.
|
||||
|
||||
Some performance improovements.
|
||||
|
||||
|
||||
0.0.5
|
||||
-----
|
||||
|
||||
Added notebook with properties page and style page. Fixed some problems
|
||||
on Windows.
|
||||
|
||||
|
||||
0.0.4
|
||||
-----
|
||||
|
||||
Some fixes suggested by RD
|
||||
|
||||
|
||||
0.0.3
|
||||
-----
|
||||
|
||||
Faster preview window refresh.
|
||||
|
||||
Cut/Paste works better.
|
||||
|
||||
Some tree icons.
|
||||
|
||||
Tree item names.
|
||||
|
||||
Bugfixes.
|
||||
|
||||
|
||||
0.0.2
|
||||
-----
|
||||
|
||||
The first release.
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
********************************************************************************
|
||||
|
||||
XRCed README
|
||||
|
||||
********************************************************************************
|
||||
|
||||
System requirements
|
||||
-------------------
|
||||
|
||||
XRCed requires wxWindows and wxPython greater or equal to 2.3.3, and
|
||||
Python 2.2 or newer (it may work with earlier version, but was not tested).
|
||||
|
||||
wxPython must be compiled with XRC support.
|
||||
|
||||
|
||||
Short manual
|
||||
------------
|
||||
|
||||
XRCed's idea is very straightforward: it is a visual tool for editing an XML
|
||||
file conforming to XRC format. Every operation performed in XRCed has direct
|
||||
correspondence to XML structure. So it is not really a usual point-and-click
|
||||
GUI builder, but don't let that scare you.
|
||||
|
||||
To start xrced, change to the directory where you installed it and run
|
||||
"python2.2 xrced.py".
|
||||
|
||||
On UNIX you can edit wrapper script "xrced.sh" to point to your installation
|
||||
directory.
|
||||
|
||||
To create an object, first you should select some object in the tree (or the
|
||||
root item if it's empty) then press the right mouse button and select an
|
||||
appropriate command. The pulldown menu is context-dependent on the selected
|
||||
object.
|
||||
|
||||
XRCed tries to guess if new object should be added as a next sibling or a
|
||||
child of current object, depending on the possibility of the object to have
|
||||
child objects and expanded state (if tree item is collapsed, new object will
|
||||
be sibling). You can change this behavior to create siblings by pressing and
|
||||
holding the Shift and Control keys before clicking the mouse.
|
||||
|
||||
Pressed Control key while pressing right button makes next item a sibling of
|
||||
selected item regardless of its expanded state.
|
||||
|
||||
Pressed Shift key changes the place for inserting new child to be before
|
||||
selected child, not after as by default.
|
||||
|
||||
Panel on the right contains object properties. Properties which are optional
|
||||
should be "checked" first. This panel can be made separate by unchecking
|
||||
"Embed Panel" in View menu.
|
||||
|
||||
All properties can be edited as text, and some are supplied with special
|
||||
editing controls.
|
||||
|
||||
The names of the properties are exactly as in XRC file, and it's usually not
|
||||
hard to guess what they do. XML ID is the name of the window, and must be
|
||||
present for top-level windows (though this is not enforced by XRCed).
|
||||
|
||||
To display the preview window double-click a top-level object (you should
|
||||
assign an XMLID to it first), press "Test" toolbar button or select command
|
||||
from View menu, or press F5. After that, if you select a child object, it
|
||||
becomes highlighted, and if you change it, preview is updated when you select
|
||||
another item or press Ctrl-R (refresh). To turn off automatic update, toggle
|
||||
"View->Auto-refresh" or toolbar auto-refresh button (to the right of the
|
||||
refresh button).
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Copyright 2001-2003 Roman Rolinsky <rollrom@xrced.sourceforge.net>
|
||||
@@ -1,29 +0,0 @@
|
||||
TODO for XRCed
|
||||
==============
|
||||
|
||||
- better help
|
||||
|
||||
+ undo/redo
|
||||
|
||||
+ tree icons
|
||||
|
||||
- replace object with another, keeping children
|
||||
|
||||
+ write tmp file for current dialog/panel/etc.
|
||||
|
||||
+ XML indents
|
||||
|
||||
+ select same notebook pages after update
|
||||
|
||||
- put some default values in tree ctrl etc.
|
||||
|
||||
- special (fast) update for some values: pos/size, value/content, sizeritem
|
||||
stuff (?), well, as much as possible
|
||||
|
||||
- highlighting with better method
|
||||
|
||||
- import XRC/WXR files
|
||||
|
||||
+ disable some window creation when it's not valid
|
||||
|
||||
- selecting object by clicking in test window
|
||||
|
Before Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 677 B |
@@ -1,4 +0,0 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
import sys, os, glob
|
||||
from wxPython.tools import img2py
|
||||
|
||||
output = 'images.py'
|
||||
|
||||
# get the list of PNG files
|
||||
files = glob.glob('src-images/*.png')
|
||||
|
||||
# Truncate the inages module
|
||||
open(output, 'w')
|
||||
|
||||
# call img2py on each file
|
||||
for file in files:
|
||||
|
||||
# extract the basename to be used as the image name
|
||||
name = os.path.splitext(os.path.basename(file))[0]
|
||||
|
||||
# encode it
|
||||
if file == files[0]:
|
||||
cmd = "-u -i -n %s %s %s" % (name, file, output)
|
||||
else:
|
||||
cmd = "-a -u -i -n %s %s %s" % (name, file, output)
|
||||
img2py.main(cmd.split())
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# Name: globals.py
|
||||
# Purpose: XRC editor, global variables
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 02.12.2002
|
||||
# RCS-ID: $Id$
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.xrc import *
|
||||
|
||||
# Global constants
|
||||
|
||||
sysFont = wxSystemSettings_GetFont(wxSYS_SYSTEM_FONT)
|
||||
labelFont = wxFont(sysFont.GetPointSize(), wxDEFAULT, wxNORMAL, wxBOLD)
|
||||
modernFont = wxFont(sysFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL)
|
||||
smallerFont = wxFont(sysFont.GetPointSize()-2, wxDEFAULT, wxNORMAL, wxNORMAL)
|
||||
|
||||
progname = 'XRCed'
|
||||
version = '0.1.1-4'
|
||||
|
||||
try:
|
||||
True
|
||||
except NameError:
|
||||
True = 1==1
|
||||
False = 1==0
|
||||
|
||||
# Global variables
|
||||
|
||||
class Globals:
|
||||
panel = None
|
||||
tree = None
|
||||
frame = None
|
||||
tools = None
|
||||
undoMan = None
|
||||
testWin = None
|
||||
testWinPos = wxDefaultPosition
|
||||
currentXXX = None
|
||||
currentEncoding = sys.getdefaultencoding() # wxLocale_GetSystemEncodingName()
|
||||
|
||||
g = Globals()
|
||||
@@ -1,23 +0,0 @@
|
||||
Copyright (c) 2002, Roman Rolinsky <rollrom@users.sourceforge.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,368 +0,0 @@
|
||||
# Name: panel.py
|
||||
# Purpose: XRC editor, Panel class and related
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 02.12.2002
|
||||
# RCS-ID: $Id$
|
||||
|
||||
from xxx import * # xxx imports globals and params
|
||||
from undo import *
|
||||
from wxPython.html import wxHtmlWindow
|
||||
|
||||
# Properties panel containing notebook
|
||||
class Panel(wxNotebook):
|
||||
def __init__(self, parent, id = -1):
|
||||
if wxPlatform != '__WXMAC__': # some problems with this style on macs
|
||||
wxNotebook.__init__(self, parent, id, style=wxNB_BOTTOM)
|
||||
else:
|
||||
wxNotebook.__init__(self, parent, id)
|
||||
global panel
|
||||
g.panel = panel = self
|
||||
self.modified = False
|
||||
|
||||
# Set common button size for parameter buttons
|
||||
bTmp = wxButton(self, -1, '')
|
||||
import params
|
||||
params.buttonSize = (self.DLG_SZE(buttonSize)[0], bTmp.GetSize()[1])
|
||||
bTmp.Destroy()
|
||||
del bTmp
|
||||
|
||||
# List of child windows
|
||||
self.pages = []
|
||||
# Create scrolled windows for pages
|
||||
self.page1 = wxScrolledWindow(self, -1)
|
||||
sizer = wxBoxSizer()
|
||||
sizer.Add(wxBoxSizer()) # dummy sizer
|
||||
self.page1.SetAutoLayout(True)
|
||||
self.page1.SetSizer(sizer)
|
||||
self.AddPage(self.page1, 'Properties')
|
||||
# Second page
|
||||
self.page2 = wxScrolledWindow(self, -1)
|
||||
sizer = wxBoxSizer()
|
||||
sizer.Add(wxBoxSizer()) # dummy sizer
|
||||
self.page2.SetAutoLayout(True)
|
||||
self.page2.SetSizer(sizer)
|
||||
# Cache for already used panels
|
||||
self.pageCache = {} # cached property panels
|
||||
self.stylePageCache = {} # cached style panels
|
||||
# Dummy parent window for cache pages
|
||||
self.cacheParent = wxFrame(None, -1, 'i am invisible')
|
||||
# Delete child windows and recreate page sizer
|
||||
def ResetPage(self, page):
|
||||
topSizer = page.GetSizer()
|
||||
sizer = topSizer.GetChildren()[0].GetSizer()
|
||||
for w in page.GetChildren():
|
||||
sizer.RemoveWindow(w)
|
||||
if isinstance(w, ParamPage):
|
||||
# With SetParent, we wouldn't need this
|
||||
w.Reparent(self.cacheParent)
|
||||
else:
|
||||
w.Destroy()
|
||||
topSizer.RemoveSizer(sizer)
|
||||
# Create new windows
|
||||
sizer = wxBoxSizer(wxVERTICAL)
|
||||
# Special case - resize html window
|
||||
if g.conf.panic:
|
||||
topSizer.Add(sizer, 1, wxEXPAND)
|
||||
else:
|
||||
topSizer.Add(sizer, 0, wxALL, 5)
|
||||
return sizer
|
||||
def SetData(self, xxx):
|
||||
self.pages = []
|
||||
# First page
|
||||
# Set cached or new page
|
||||
# Remove current objects and sizer
|
||||
sizer = self.ResetPage(self.page1)
|
||||
if not xxx or (not xxx.allParams and not xxx.hasName):
|
||||
if g.tree.selection:
|
||||
sizer.Add(wxStaticText(self.page1, -1, 'This item has no properties.'))
|
||||
else: # nothing selected
|
||||
# If first time, show some help
|
||||
if g.conf.panic:
|
||||
html = wxHtmlWindow(self.page1, -1, wxDefaultPosition,
|
||||
wxDefaultSize, wxSUNKEN_BORDER)
|
||||
html.SetPage(g.helpText)
|
||||
sizer.Add(html, 1, wxEXPAND)
|
||||
g.conf.panic = False
|
||||
else:
|
||||
sizer.Add(wxStaticText(self.page1, -1, 'Select a tree item.'))
|
||||
else:
|
||||
g.currentXXX = xxx.treeObject()
|
||||
try:
|
||||
page = self.pageCache[xxx.__class__]
|
||||
page.Reparent(self.page1)
|
||||
except KeyError:
|
||||
page = PropPage(self.page1, xxx.className, xxx)
|
||||
self.pageCache[xxx.__class__] = page
|
||||
page.SetValues(xxx)
|
||||
self.pages.append(page)
|
||||
sizer.Add(page, 1, wxEXPAND)
|
||||
if xxx.hasChild:
|
||||
# Special label for child objects - they may have different GUI
|
||||
cacheID = (xxx.child.__class__, xxx.__class__)
|
||||
try:
|
||||
page = self.pageCache[cacheID]
|
||||
page.Reparent(self.page1)
|
||||
except KeyError:
|
||||
page = PropPage(self.page1, xxx.child.className, xxx.child)
|
||||
self.pageCache[cacheID] = page
|
||||
page.SetValues(xxx.child)
|
||||
self.pages.append(page)
|
||||
sizer.Add(page, 0, wxEXPAND | wxTOP, 5)
|
||||
self.page1.Layout()
|
||||
size = self.page1.GetSizer().GetMinSize()
|
||||
self.page1.SetScrollbars(1, 1, size.x, size.y, 0, 0, True)
|
||||
|
||||
# Second page
|
||||
# Create if does not exist
|
||||
if xxx and xxx.treeObject().hasStyle:
|
||||
xxx = xxx.treeObject()
|
||||
# Simplest case: set data if class is the same
|
||||
sizer = self.ResetPage(self.page2)
|
||||
try:
|
||||
page = self.stylePageCache[xxx.__class__]
|
||||
page.Reparent(self.page2)
|
||||
except KeyError:
|
||||
page = StylePage(self.page2, xxx.className + ' style', xxx)
|
||||
self.stylePageCache[xxx.__class__] = page
|
||||
page.SetValues(xxx)
|
||||
self.pages.append(page)
|
||||
sizer.Add(page, 0, wxEXPAND)
|
||||
# Add page if not exists
|
||||
if not self.GetPageCount() == 2:
|
||||
self.AddPage(self.page2, 'Style')
|
||||
self.page2.Layout()
|
||||
size = self.page2.GetSizer().GetMinSize()
|
||||
self.page2.SetScrollbars(1, 1, size.x, size.y, 0, 0, True)
|
||||
else:
|
||||
# Remove page if exists
|
||||
if self.GetPageCount() == 2:
|
||||
self.SetSelection(0)
|
||||
self.page1.Refresh()
|
||||
self.RemovePage(1)
|
||||
self.modified = False
|
||||
def Clear(self):
|
||||
self.SetData(None)
|
||||
self.modified = False
|
||||
# If some parameter has changed
|
||||
def IsModified(self):
|
||||
return self.modified
|
||||
def SetModified(self, value):
|
||||
# Register undo object when modifying first time
|
||||
if not self.modified and value:
|
||||
g.undoMan.RegisterUndo(UndoEdit())
|
||||
self.modified = value
|
||||
def Apply(self):
|
||||
for p in self.pages: p.Apply()
|
||||
|
||||
################################################################################
|
||||
|
||||
# General class for notebook pages
|
||||
class ParamPage(wxPanel):
|
||||
def __init__(self, parent, xxx):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.xxx = xxx
|
||||
# Register event handlers
|
||||
for id in paramIDs.values():
|
||||
EVT_CHECKBOX(self, id, self.OnCheckParams)
|
||||
self.checks = {}
|
||||
self.controls = {} # save python objects
|
||||
self.controlName = None
|
||||
|
||||
def OnCheckParams(self, evt):
|
||||
xxx = self.xxx
|
||||
param = evt.GetEventObject().GetName()
|
||||
w = self.controls[param]
|
||||
w.Enable(True)
|
||||
objElem = xxx.element
|
||||
if evt.IsChecked():
|
||||
# Ad new text node in order of allParams
|
||||
w.SetValue('') # set empty (default) value
|
||||
w.SetModified() # mark as changed
|
||||
elem = g.tree.dom.createElement(param)
|
||||
# Some classes are special
|
||||
if param == 'font':
|
||||
xxx.params[param] = xxxParamFont(xxx.element, elem)
|
||||
elif param in xxxObject.bitmapTags:
|
||||
xxx.params[param] = xxxParamBitmap(elem)
|
||||
else:
|
||||
xxx.params[param] = xxxParam(elem)
|
||||
# Find place to put new element: first present element after param
|
||||
found = False
|
||||
paramStyles = xxx.allParams + xxx.styles
|
||||
for p in paramStyles[paramStyles.index(param) + 1:]:
|
||||
# Content params don't have same type
|
||||
if xxx.params.has_key(p) and p != 'content':
|
||||
found = True
|
||||
break
|
||||
if found:
|
||||
nextTextElem = xxx.params[p].node
|
||||
objElem.insertBefore(elem, nextTextElem)
|
||||
else:
|
||||
objElem.appendChild(elem)
|
||||
else:
|
||||
# Remove parameter
|
||||
xxx.params[param].remove()
|
||||
del xxx.params[param]
|
||||
w.SetValue('')
|
||||
w.modified = False # mark as not changed
|
||||
w.Enable(False)
|
||||
# Set modified flag (provokes undo storing is necessary)
|
||||
panel.SetModified(True)
|
||||
def Apply(self):
|
||||
xxx = self.xxx
|
||||
if self.controlName:
|
||||
name = self.controlName.GetValue()
|
||||
if xxx.name != name:
|
||||
xxx.name = name
|
||||
xxx.element.setAttribute('name', name)
|
||||
for param, w in self.controls.items():
|
||||
if w.modified:
|
||||
paramObj = xxx.params[param]
|
||||
value = w.GetValue()
|
||||
if param in xxx.specials:
|
||||
xxx.setSpecial(param, value)
|
||||
else:
|
||||
paramObj.update(value)
|
||||
# Save current state
|
||||
def SaveState(self):
|
||||
self.origChecks = map(lambda i: (i[0], i[1].GetValue()), self.checks.items())
|
||||
self.origControls = map(lambda i: (i[0], i[1].GetValue(), i[1].IsEnabled()),
|
||||
self.controls.items())
|
||||
if self.controlName:
|
||||
self.origName = self.controlName.GetValue()
|
||||
# Return original values
|
||||
def GetState(self):
|
||||
if self.controlName:
|
||||
return (self.origChecks, self.origControls, self.origName)
|
||||
else:
|
||||
return (self.origChecks, self.origControls)
|
||||
# Set values from undo data
|
||||
def SetState(self, state):
|
||||
for k,v in state[0]:
|
||||
self.checks[k].SetValue(v)
|
||||
for k,v,e in state[1]:
|
||||
self.controls[k].SetValue(v)
|
||||
self.controls[k].Enable(e)
|
||||
if e: self.controls[k].modified = True
|
||||
if self.controlName:
|
||||
self.controlName.SetValue(state[2])
|
||||
|
||||
################################################################################
|
||||
|
||||
# Panel for displaying properties
|
||||
class PropPage(ParamPage):
|
||||
def __init__(self, parent, label, xxx):
|
||||
ParamPage.__init__(self, parent, xxx)
|
||||
box = wxStaticBox(self, -1, label)
|
||||
box.SetFont(labelFont)
|
||||
topSizer = wxStaticBoxSizer(box, wxVERTICAL)
|
||||
sizer = wxFlexGridSizer(len(xxx.allParams), 2, 1, 1)
|
||||
sizer.AddGrowableCol(1)
|
||||
if xxx.hasName:
|
||||
label = wxStaticText(self, -1, 'XML ID:', size=(100,-1))
|
||||
control = ParamText(self, 'XML_name', 200)
|
||||
sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
|
||||
(control, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxGROW, 5) ])
|
||||
self.controlName = control
|
||||
for param in xxx.allParams:
|
||||
present = xxx.params.has_key(param)
|
||||
if param in xxx.required:
|
||||
label = wxStaticText(self, paramIDs[param], param + ':',
|
||||
size = (100,-1), name = param)
|
||||
else:
|
||||
# Notebook has one very loooooong parameter
|
||||
if param == 'usenotebooksizer': sParam = 'usesizer:'
|
||||
else: sParam = param + ':'
|
||||
label = wxCheckBox(self, paramIDs[param], sParam,
|
||||
size = (100,-1), name = param)
|
||||
self.checks[param] = label
|
||||
try:
|
||||
typeClass = xxx.paramDict[param]
|
||||
except KeyError:
|
||||
try:
|
||||
# Standart type
|
||||
typeClass = paramDict[param]
|
||||
except KeyError:
|
||||
# Default
|
||||
typeClass = ParamText
|
||||
control = typeClass(self, param)
|
||||
control.Enable(present)
|
||||
sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
|
||||
(control, 0, wxALIGN_CENTER_VERTICAL | wxGROW) ])
|
||||
self.controls[param] = control
|
||||
topSizer.Add(sizer, 1, wxALL | wxEXPAND, 3)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(topSizer)
|
||||
topSizer.Fit(self)
|
||||
def SetValues(self, xxx):
|
||||
self.xxx = xxx
|
||||
self.origChecks = []
|
||||
self.origControls = []
|
||||
# Set values, checkboxes to False, disable defaults
|
||||
if xxx.hasName:
|
||||
self.controlName.SetValue(xxx.name)
|
||||
self.origName = xxx.name
|
||||
for param in xxx.allParams:
|
||||
w = self.controls[param]
|
||||
w.modified = False
|
||||
try:
|
||||
value = xxx.params[param].value()
|
||||
w.Enable(True)
|
||||
w.SetValue(value)
|
||||
if not param in xxx.required:
|
||||
self.checks[param].SetValue(True)
|
||||
self.origChecks.append((param, True))
|
||||
self.origControls.append((param, value, True))
|
||||
except KeyError:
|
||||
self.checks[param].SetValue(False)
|
||||
w.SetValue('')
|
||||
w.Enable(False)
|
||||
self.origChecks.append((param, False))
|
||||
self.origControls.append((param, '', False))
|
||||
|
||||
################################################################################
|
||||
|
||||
# Style notebook page
|
||||
class StylePage(ParamPage):
|
||||
def __init__(self, parent, label, xxx):
|
||||
ParamPage.__init__(self, parent, xxx)
|
||||
box = wxStaticBox(self, -1, label)
|
||||
box.SetFont(labelFont)
|
||||
topSizer = wxStaticBoxSizer(box, wxVERTICAL)
|
||||
sizer = wxFlexGridSizer(len(xxx.styles), 2, 1, 1)
|
||||
sizer.AddGrowableCol(1)
|
||||
for param in xxx.styles:
|
||||
present = xxx.params.has_key(param)
|
||||
check = wxCheckBox(self, paramIDs[param],
|
||||
param + ':', size = (100,-1), name = param)
|
||||
check.SetValue(present)
|
||||
control = paramDict[param](self, name = param)
|
||||
control.Enable(present)
|
||||
sizer.AddMany([ (check, 0, wxALIGN_CENTER_VERTICAL),
|
||||
(control, 0, wxALIGN_CENTER_VERTICAL | wxGROW) ])
|
||||
self.checks[param] = check
|
||||
self.controls[param] = control
|
||||
topSizer.Add(sizer, 1, wxALL | wxEXPAND, 3)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(topSizer)
|
||||
topSizer.Fit(self)
|
||||
# Set data for a cahced page
|
||||
def SetValues(self, xxx):
|
||||
self.xxx = xxx
|
||||
self.origChecks = []
|
||||
self.origControls = []
|
||||
for param in xxx.styles:
|
||||
present = xxx.params.has_key(param)
|
||||
check = self.checks[param]
|
||||
check.SetValue(present)
|
||||
w = self.controls[param]
|
||||
w.modified = False
|
||||
if present:
|
||||
value = xxx.params[param].value()
|
||||
else:
|
||||
value = ''
|
||||
w.SetValue(value)
|
||||
w.Enable(present)
|
||||
self.origChecks.append((param, present))
|
||||
self.origControls.append((param, value, present))
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
(require 'sawmill-defaults)
|
||||
|
||||
;;; Define two hooks to reset focus behavior while mapping test window
|
||||
|
||||
(define (xrced-match-window-before w)
|
||||
(setq prop (aref (get-x-text-property w 'WM_CLASS) 0))
|
||||
(cond ((equal prop "_XRCED_T_W")
|
||||
(setq transients-get-focus-b transients-get-focus)
|
||||
(setq transients-get-focus nil)
|
||||
(setq focus-windows-when-mapped-b focus-windows-when-mapped)
|
||||
(setq focus-windows-when-mapped nil)
|
||||
)
|
||||
)
|
||||
)
|
||||
(define (xrced-match-window-after w)
|
||||
(setq prop (aref (get-x-text-property w 'WM_CLASS) 0))
|
||||
(cond ((equal prop "_XRCED_T_W")
|
||||
(setq transients-get-focus-b transients-get-focus-b)
|
||||
(setq focus-windows-when-mapped focus-windows-when-mapped-b)
|
||||
)
|
||||
)
|
||||
)
|
||||
(add-hook 'map-notify-hook xrced-match-window-before)
|
||||
(add-hook 'map-notify-hook xrced-match-window-after 't)
|
||||
|
Before Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 616 B |
|
Before Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 135 B |
|
Before Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 140 B |
|
Before Width: | Height: | Size: 296 B |
|
Before Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 254 B |
|
Before Width: | Height: | Size: 80 B |