from wxPython.wx import *
from wxPython.xrc import *
-from wxPython.html import *
+from wxPython.html import wxHtmlWindow
from xml.dom import minidom
import os
import getopt
modernFont = wxFont(10, wxMODERN, wxNORMAL, wxNORMAL)
progname = 'XRCed'
-version = '0.0.7-2'
+version = '0.0.7-3'
# Local modules
from xxx import *
else:
# Remove page if exists
if self.GetPageCount() == 2:
+ self.SetSelection(0)
+ self.page1.Refresh()
self.RemovePage(1)
def Clear(self):
self.SetData(None)
present = param in xxx.params.keys()
check = self.checks[param]
check.SetValue(present)
- control = self.controls[param]
+ w = self.controls[param]
+ w.modified = false
if present:
- control.SetValue(xxx.params[param].value())
+ w.SetValue(xxx.params[param].value())
else:
- control.SetValue('')
- control.Enable(present)
+ w.SetValue('')
+ w.Enable(present)
self.SetModified(false)
################################################################################
self.SetBackgroundColour(wxColour(224, 248, 224))
EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
# One works on Linux, another on Windows
- if wxGetOsVersion()[1] == 1:
+ if wxGetOsVersion()[0] == wxGTK:
EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated)
else:
EVT_LEFT_DCLICK(self, self.OnDClick)
except:
print 'ERROR: MakeXXXFromDom(%s, %s)' % (xxxParent, node)
raise
-# return
treeObj = xxx.treeObject()
# Append tree item
item = self.AppendItem(itemParent, treeObj.treeName(),
if panel.IsModified():
self.Apply(xxx, oldItem)
#if conf.autoRefresh:
- if testWin and not tree.IsHighlatable(oldItem):
- if testWin.highLight:
+ if testWin:
+ if testWin.highLight and not tree.IsHighlatable(oldItem):
testWin.highLight.Remove()
self.needUpdate = true
status = 'Changes were applied'
icon = wxIcon(os.path.join(sys.path[0], 'xrced.ico'), wxBITMAP_TYPE_ICO)
self.SetIcon(icon)
- # Defaults
- self.sashPos = 100
- self.panelX = self.panelY = -1
- self.panelWidth = 300
- self.panelHeight = 200
-
- # Idle flas
+ # Idle flag
self.inIdle = false
# Make menus
'Refresh', 'Refresh view')
tb.AddSimpleTool(self.ID_AUTO_REFRESH, images.getAutoRefreshBitmap(),
'Auto-refresh', 'Toggle auto-refresh mode', true)
- if wxGetOsVersion()[1] == 1:
+ if wxGetOsVersion()[0] == wxGTK:
tb.AddSeparator() # otherwise auto-refresh sticks in status line
tb.ToggleTool(self.ID_AUTO_REFRESH, conf.autoRefresh)
tb.Realize()
self.tb = tb
+ self.minWidth = tb.GetSize()[0] # minimal width is the size of toolbar
# File
EVT_MENU(self, wxID_NEW, self.OnNew)
conf.embedPanel = evt.IsChecked()
if conf.embedPanel:
# Remember last dimentions
- self.panelWidth, self.panelHeight = panel.GetSize()
+ conf.panelX, conf.panelY = self.miniFrame.GetPosition()
+ conf.panelWidth, conf.panelHeight = self.miniFrame.GetSize()
+ size = self.GetSize()
+ pos = self.GetPosition()
+ sizePanel = panel.GetSize()
panel.Reparent(self.splitter)
self.miniFrame.GetSizer().RemoveWindow(panel)
- self.splitter.SplitVertically(tree, panel, self.sashPos)
+ wxYield()
+ # Widen
+ self.SetDimensions(pos.x, pos.y, size.x + sizePanel.x, size.y)
+ self.splitter.SplitVertically(tree, panel, conf.sashPos)
self.miniFrame.Show(false)
else:
- self.sashPos = self.splitter.GetSashPosition()
+ conf.sashPos = self.splitter.GetSashPosition()
+ pos = self.GetPosition()
+ size = self.GetSize()
+ sizePanel = panel.GetSize()
self.splitter.Unsplit(panel)
sizer = self.miniFrame.GetSizer()
panel.Reparent(self.miniFrame)
panel.Show(true)
sizer.Add(panel, 1, wxEXPAND)
self.miniFrame.Show(true)
- self.miniFrame.SetSize((self.panelWidth, self.panelHeight))
+ self.miniFrame.SetDimensions(conf.panelX, conf.panelY,
+ conf.panelWidth, conf.panelHeight)
+ wxYield()
+ # Reduce width
+ self.SetDimensions(pos.x, pos.y,
+ max(size.x - sizePanel.x, self.minWidth), size.y)
def OnTest(self, evt):
if not tree.selection: return # key pressed event
evt.Enable((self.clipboard and tree.selection) != None)
elif evt.GetId() == self.ID_TEST:
evt.Enable(tree.selection != tree.root)
- elif evt.GetId() == self.ID_REFRESH:
- evt.Enable(testWin != None)
def OnIdle(self, evt):
if self.inIdle: return # Recursive call protection
if testWin: testWin.Destroy()
# Destroy cached windows
panel.cacheParent.Destroy()
-# for w in panel.styleCache.values(): w.Destroy()
if not panel.GetPageCount() == 2:
panel.page2.Destroy()
conf.x, conf.y = self.GetPosition()
conf.width, conf.height = self.GetSize()
if conf.embedPanel:
conf.sashPos = self.splitter.GetSashPosition()
- conf.panelWidth, conf.panelHeight = self.panelWidth, self.panelHeight
else:
- conf.sashPos = self.sashPos
conf.panelX, conf.panelY = self.miniFrame.GetPosition()
conf.panelWidth, conf.panelHeight = self.miniFrame.GetSize()
evt.Skip()
self.OnRefresh(wxCommandEvent())
f = open(path, 'w')
# Make temporary copy
- self.domCopy = domCopy = tree.dom.cloneNode(true)
- self.Indent(domCopy.getElementsByTagName('resource')[0])
- domCopy.writexml(f)
-# domCopy.unlink()
- self.domCopy = None
+ # !!! We can't clone dom node, it works only once
+ #self.domCopy = tree.dom.cloneNode(true)
+ self.domCopy = minidom.Document()
+ mainNode = self.domCopy.appendChild(tree.mainNode.cloneNode(true))
+ self.Indent(mainNode)
+ self.domCopy.writexml(f)
f.close()
+ self.domCopy.unlink()
+ self.domCopy = None
self.modified = false
panel.SetModified(false)
except: