本文整理汇总了Python中util.finishWindow函数的典型用法代码示例。如果您正苦于以下问题:Python finishWindow函数的具体用法?Python finishWindow怎么用?Python finishWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了finishWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, id, cfg):
wx.Panel.__init__(self, parent, id)
self.cfg = cfg
# list of names. each name is both the name of a wx.TextCtrl in
# this class and the name of a string configuration variable in
# cfg.
self.items = []
vsizer = wx.BoxSizer(wx.VERTICAL)
gsizer = wx.FlexGridSizer(4, 2, 5, 0)
self.addEntry("strContinuedPageEnd", "(CONTINUED)", self, gsizer)
self.addEntry("strContinuedPageStart", "CONTINUED:", self, gsizer)
self.addEntry("strMore", "(MORE)", self, gsizer)
self.addEntry("strDialogueContinued", " (cont'd)", self, gsizer)
gsizer.AddGrowableCol(1)
vsizer.Add(gsizer, 0, wx.EXPAND)
self.cfg2gui()
util.finishWindow(self, vsizer, center=False)
for it in self.items:
wx.EVT_TEXT(self, getattr(self, it).GetId(), self.OnMisc)
示例2: __init__
def __init__(self, parent, id, cfg):
wx.Panel.__init__(self, parent, id)
self.cfg = cfg
self.blockEvents = True
# last directory we chose a font from
self.lastDir = u""
vsizer = wx.BoxSizer(wx.VERTICAL)
vsizer.Add(wx.StaticText(self, -1,
"Leave all the fields empty to use the default PDF Courier\n"
"fonts. This is highly recommended.\n"
"\n"
"Otherwise, fill in the font name (e.g. AndaleMono) to use\n"
"the specified TrueType font. If you want to embed the font\n"
"in the generated PDF files, fill in the font filename as well.\n"
"\n"
"See the manual for the full details.\n"))
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add(wx.StaticText(self, -1, "Type:"), 0,
wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
self.typeCombo = wx.ComboBox(self, -1, style = wx.CB_READONLY)
for pfi in self.cfg.getPDFFontIds():
pf = self.cfg.getPDFFont(pfi)
self.typeCombo.Append(pf.name, pf)
hsizer.Add(self.typeCombo, 0)
vsizer.Add(hsizer, 0, wx.EXPAND)
vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
gsizer = wx.FlexGridSizer(2, 3, 5, 5)
gsizer.AddGrowableCol(1)
self.addEntry("nameEntry", "Name:", self, gsizer)
gsizer.Add((1,1), 0)
self.addEntry("fileEntry", "File:", self, gsizer)
btn = wx.Button(self, -1, "Browse")
gsizer.Add(btn)
wx.EVT_BUTTON(self, btn.GetId(), self.OnBrowse)
vsizer.Add(gsizer, 0, wx.EXPAND)
util.finishWindow(self, vsizer, center = False)
wx.EVT_COMBOBOX(self, self.typeCombo.GetId(), self.OnTypeCombo)
self.typeCombo.SetSelection(0)
self.OnTypeCombo()
self.blockEvents = False
示例3: __init__
def __init__(self, parent, items):
wx.Dialog.__init__(self, parent, -1, "Choose scripts",
style = wx.DEFAULT_DIALOG_STYLE)
vsizer = wx.BoxSizer(wx.VERTICAL)
gsizer = wx.FlexGridSizer(2, 2, 5, 0)
self.addCombo("first", "Compare script", self, gsizer, items, 0)
self.addCombo("second", "to", self, gsizer, items, 1)
vsizer.Add(gsizer)
self.forceCb = wx.CheckBox(self, -1, "Use same configuration")
self.forceCb.SetValue(True)
vsizer.Add(self.forceCb, 0, wx.TOP, 10)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add((1, 1), 1)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
okBtn.SetFocus()
示例4: __init__
def __init__(self, parent, indents):
wx.Dialog.__init__(self, parent, -1, "Adjust styles", style=wx.DEFAULT_DIALOG_STYLE)
indents.sort(lambda i1, i2: -cmp(len(i1.lines), len(i2.lines)))
vsizer = wx.BoxSizer(wx.VERTICAL)
tmp = wx.StaticText(self, -1, "Input:")
vsizer.Add(tmp)
self.inputLb = wx.ListBox(self, -1, size=(400, 200))
for it in indents:
self.inputLb.Append("%d lines (indented %d characters)" % (len(it.lines), it.indent), it)
vsizer.Add(self.inputLb, 0, wx.EXPAND)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add(wx.StaticText(self, -1, "Style:"), 0, wx.ALIGN_CENTER_VERTICAL)
self.styleCombo = wx.ComboBox(self, -1, style=wx.CB_READONLY)
self.styleCombo.Append("Scene / Action", SCENE_ACTION)
for t in config.getTIs():
self.styleCombo.Append(t.name, t.lt)
util.setWH(self.styleCombo, w=150)
hsizer.Add(self.styleCombo, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.TOP | wx.BOTTOM, 10)
vsizer.Add(wx.StaticText(self, -1, "Lines:"))
self.linesEntry = wx.TextCtrl(self, -1, size=(400, 200), style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
vsizer.Add(self.linesEntry, 0, wx.EXPAND)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add((1, 1), 1)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)
util.finishWindow(self, vsizer)
wx.EVT_COMBOBOX(self, self.styleCombo.GetId(), self.OnStyleCombo)
wx.EVT_LISTBOX(self, self.inputLb.GetId(), self.OnInputLb)
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
self.inputLb.SetSelection(0)
self.OnInputLb()
示例5: __init__
def __init__(self, parent, sp, prefix):
wx.Dialog.__init__(self, parent, -1, "Watermarked PDFs generator",
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.frame = parent
self.sp = sp
vsizer = wx.BoxSizer(wx.VERTICAL)
vsizer.Add(wx.StaticText(self, -1, "Directory to save in:"), 0)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
self.dirEntry = wx.TextCtrl(self, -1)
hsizer.Add(self.dirEntry, 1, wx.EXPAND)
btn = wx.Button(self, -1, "Browse")
wx.EVT_BUTTON(self, btn.GetId(), self.OnBrowse)
hsizer.Add(btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
vsizer.Add(wx.StaticText(self, -1, "Filename prefix:"), 0)
self.filenamePrefix = wx.TextCtrl(self, -1, prefix)
vsizer.Add(self.filenamePrefix, 0, wx.EXPAND | wx.BOTTOM, 5)
vsizer.Add(wx.StaticText(self, -1, "Watermark font size:"), 0)
self.markSize = wx.SpinCtrl(self, -1, size=(60, -1))
self.markSize.SetRange(20, 80)
self.markSize.SetValue(40)
vsizer.Add(self.markSize, 0, wx.BOTTOM, 5)
vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
vsizer.Add(wx.StaticText(self, -1, "Common mark:"), 0)
self.commonMark = wx.TextCtrl(self, -1, "Confidential")
vsizer.Add(self.commonMark, 0, wx.EXPAND| wx.BOTTOM, 5)
vsizer.Add(wx.StaticText(self, -1, "Watermarks (one per line):"))
self.itemsEntry = wx.TextCtrl(
self, -1, style = wx.TE_MULTILINE | wx.TE_DONTWRAP,
size = (300, 200))
vsizer.Add(self.itemsEntry, 1, wx.EXPAND)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
closeBtn = wx.Button(self, -1, "Close")
hsizer.Add(closeBtn, 0)
hsizer.Add((1, 1), 1)
generateBtn = wx.Button(self, -1, "Generate PDFs")
hsizer.Add(generateBtn, 0)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, closeBtn.GetId(), self.OnClose)
wx.EVT_BUTTON(self, generateBtn.GetId(), self.OnGenerate)
self.dirEntry.SetFocus()
示例6: __init__
def __init__(self, parent, autoCompletion):
wx.Dialog.__init__(self, parent, -1, "Auto-completion",
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.autoCompletion = autoCompletion
vsizer = wx.BoxSizer(wx.VERTICAL)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
self.elementsCombo = wx.ComboBox(self, -1, style=wx.CB_READONLY | wx.EXPAND)
for t in autoCompletion.types.itervalues():
self.elementsCombo.Append(t.ti.name, t.ti.lt)
wx.EVT_COMBOBOX(self, self.elementsCombo.GetId(), self.OnElementCombo)
hsizer.Add(self.elementsCombo, 0)
vsizer.Add(hsizer, 0, wx.EXPAND)
vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
self.enabledCb = wx.CheckBox(self, -1, "Auto-completion Enabled")
wx.EVT_CHECKBOX(self, self.enabledCb.GetId(), self.OnMisc)
vsizer.Add(self.enabledCb, 0, wx.BOTTOM, 10)
self.itemsEntry = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE |
wx.TE_DONTWRAP, size=(200, 250))
wx.EVT_TEXT(self, self.itemsEntry.GetId(), self.OnMisc)
vsizer.Add(self.itemsEntry, 1, wx.EXPAND)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add((1, 1), 1)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn, 0, wx.LEFT, 10)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)
util.finishWindow(self, vsizer)
self.elementsCombo.SetSelection(0)
self.OnElementCombo()
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
示例7: __init__
def __init__(self, parent, sp):
wx.Dialog.__init__(self, parent, -1, "Locations",
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.sp = sp
vsizer = wx.BoxSizer(wx.VERTICAL)
tmp = wx.StaticText(self, -1, "Locations:")
vsizer.Add(tmp)
self.locationsLb = wx.ListBox(self, -1, size = (450, 200))
vsizer.Add(self.locationsLb, 1, wx.EXPAND)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
self.addBtn = gutil.createStockButton(self, "Add")
hsizer.Add(self.addBtn)
wx.EVT_BUTTON(self, self.addBtn.GetId(), self.OnAdd)
self.delBtn = gutil.createStockButton(self, "Delete")
hsizer.Add(self.delBtn, 0, wx.LEFT, 10)
wx.EVT_BUTTON(self, self.delBtn.GetId(), self.OnDelete)
vsizer.Add(hsizer, 0, wx.ALIGN_CENTER | wx.TOP, 10)
tmp = wx.StaticText(self, -1, "Scenes:")
vsizer.Add(tmp)
self.scenesLb = wx.ListBox(self, -1, size = (450, 200),
style = wx.LB_EXTENDED)
vsizer.Add(self.scenesLb, 1, wx.EXPAND)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add((1, 1), 1)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn, 0, wx.LEFT, 10)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
self.fillGui()
示例8: __init__
def __init__(self, parent, ctrl):
wx.Dialog.__init__(self, parent, -1, "Character map")
self.ctrl = ctrl
hsizer = wx.BoxSizer(wx.HORIZONTAL)
self.charMap = MyCharMap(self)
hsizer.Add(self.charMap)
self.insertButton = wx.Button(self, -1, " Insert character ")
hsizer.Add(self.insertButton, 0, wx.ALL, 10)
wx.EVT_BUTTON(self, self.insertButton.GetId(), self.OnInsert)
gutil.btnDblClick(self.insertButton, self.OnInsert)
util.finishWindow(self, hsizer, 0)
示例9: __init__
def __init__(self, parent, text, title):
wx.Dialog.__init__(self, parent, -1, title, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
vsizer = wx.BoxSizer(wx.VERTICAL)
tc = wx.TextCtrl(self, -1, size=wx.Size(400, 200), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LINEWRAP)
tc.SetValue(text)
vsizer.Add(tc, 1, wx.EXPAND)
vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
okBtn = gutil.createStockButton(self, "OK")
vsizer.Add(okBtn, 0, wx.ALIGN_CENTER)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
okBtn.SetFocus()
示例10: __init__
def __init__(self, parent, scDict, isGlobal):
wx.Dialog.__init__(self, parent, -1, "Spell checker dictionary",
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.scDict = scDict
vsizer = wx.BoxSizer(wx.VERTICAL)
if isGlobal:
s = "Global words:"
else:
s = "Script-specific words:"
vsizer.Add(wx.StaticText(self, -1, s))
self.itemsEntry = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE |
wx.TE_DONTWRAP, size = (300, 300))
vsizer.Add(self.itemsEntry, 1, wx.EXPAND)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add((1, 1), 1)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn, 0, wx.LEFT, 10)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)
self.cfg2gui()
util.finishWindow(self, vsizer)
wx.EVT_TEXT(self, self.itemsEntry.GetId(), self.OnMisc)
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
示例11: __init__
#.........这里部分代码省略.........
hsizer.Add(self.textEntry, 1, wx.LEFT, 10)
wx.EVT_TEXT(self, self.textEntry.GetId(), self.OnMisc)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 20)
vsizer.Add(wx.StaticText(self, -1,
"'${PAGE}' will be replaced by the page number."), 0,
wx.ALIGN_CENTER | wx.TOP, 5)
hsizerTop = wx.BoxSizer(wx.HORIZONTAL)
gsizer = wx.FlexGridSizer(3, 2, 5, 0)
gsizer.Add(wx.StaticText(self, -1, "Header line:"), 0,
wx.ALIGN_CENTER_VERTICAL)
self.lineEntry = wx.SpinCtrl(self, -1)
self.lineEntry.SetRange(1, 5)
wx.EVT_SPINCTRL(self, self.lineEntry.GetId(), self.OnMisc)
wx.EVT_KILL_FOCUS(self.lineEntry, self.OnKillFocus)
gsizer.Add(self.lineEntry)
gsizer.Add(wx.StaticText(self, -1, "X offset (characters):"), 0,
wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
self.xoffEntry = wx.SpinCtrl(self, -1)
self.xoffEntry.SetRange(-100, 100)
wx.EVT_SPINCTRL(self, self.xoffEntry.GetId(), self.OnMisc)
wx.EVT_KILL_FOCUS(self.xoffEntry, self.OnKillFocus)
gsizer.Add(self.xoffEntry)
gsizer.Add(wx.StaticText(self, -1, "Alignment:"), 0,
wx.ALIGN_CENTER_VERTICAL)
self.alignCombo = wx.ComboBox(self, -1, style = wx.CB_READONLY)
for it in [ ("Left", util.ALIGN_LEFT), ("Center", util.ALIGN_CENTER),
("Right", util.ALIGN_RIGHT) ]:
self.alignCombo.Append(it[0], it[1])
gsizer.Add(self.alignCombo)
wx.EVT_COMBOBOX(self, self.alignCombo.GetId(), self.OnMisc)
hsizerTop.Add(gsizer)
bsizer = wx.StaticBoxSizer(
wx.StaticBox(self, -1, "Style"), wx.HORIZONTAL)
vsizer2 = wx.BoxSizer(wx.VERTICAL)
# wxGTK adds way more space by default than wxMSW between the
# items, have to adjust for that
pad = 0
if misc.isWindows:
pad = 5
self.addCheckBox("Bold", self, vsizer2, pad)
self.addCheckBox("Italic", self, vsizer2, pad)
self.addCheckBox("Underlined", self, vsizer2, pad)
bsizer.Add(vsizer2)
hsizerTop.Add(bsizer, 0, wx.LEFT, 40)
vsizer.Add(hsizerTop, 0, wx.TOP, 20)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add((1, 1), 1)
previewBtn = gutil.createStockButton(self, "Preview")
hsizer.Add(previewBtn)
applyBtn = gutil.createStockButton(self, "Apply")
hsizer.Add(applyBtn, 0, wx.LEFT, 10)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn, 0, wx.LEFT, 10)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 20)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, previewBtn.GetId(), self.OnPreview)
wx.EVT_BUTTON(self, applyBtn.GetId(), self.OnApply)
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
wx.EVT_LISTBOX(self, self.stringsLb.GetId(), self.OnStringsLb)
# list of widgets that are specific to editing the selected string
self.widList = [ self.textEntry, self.xoffEntry, self.alignCombo,
self.lineEntry, self.boldCb, self.italicCb,
self.underlinedCb ]
self.updateGui()
self.textEntry.SetFocus()
示例12: __init__
def __init__(self, parent, ctrl, sc, gScDict):
wx.Dialog.__init__(self, parent, -1, "Spell checker",
style = wx.DEFAULT_DIALOG_STYLE | wx.WANTS_CHARS)
self.ctrl = ctrl
# spellcheck.SpellCheck
self.sc = sc
# user's global spell checker dictionary
self.gScDict = gScDict
# have we added any words to global dictionary
self.changedGlobalDict = False
vsizer = wx.BoxSizer(wx.VERTICAL)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add(wx.StaticText(self, -1, "Word:"), 0,
wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
self.replaceEntry = wx.TextCtrl(self, -1, style = wx.TE_PROCESS_ENTER)
hsizer.Add(self.replaceEntry, 1, wx.EXPAND)
vsizer.Add(hsizer, 1, wx.EXPAND | wx.BOTTOM, 15)
gsizer = wx.FlexGridSizer(2, 2, 10, 10)
gsizer.AddGrowableCol(1)
replaceBtn = wx.Button(self, -1, "&Replace")
gsizer.Add(replaceBtn)
addScriptBtn = wx.Button(self, -1, "Add to &script dictionary")
gsizer.Add(addScriptBtn, 0, wx.EXPAND)
skipBtn = wx.Button(self, -1, "S&kip")
gsizer.Add(skipBtn)
addGlobalBtn = wx.Button(self, -1, "Add to &global dictionary")
gsizer.Add(addGlobalBtn, 0, wx.EXPAND)
vsizer.Add(gsizer, 0, wx.EXPAND, 0)
suggestBtn = wx.Button(self, -1, "S&uggest replacement")
vsizer.Add(suggestBtn, 0, wx.EXPAND | wx.TOP, 10)
wx.EVT_TEXT_ENTER(self, self.replaceEntry.GetId(), self.OnReplace)
wx.EVT_BUTTON(self, replaceBtn.GetId(), self.OnReplace)
wx.EVT_BUTTON(self, addScriptBtn.GetId(), self.OnAddScript)
wx.EVT_BUTTON(self, addGlobalBtn.GetId(), self.OnAddGlobal)
wx.EVT_BUTTON(self, skipBtn.GetId(), self.OnSkip)
wx.EVT_BUTTON(self, suggestBtn.GetId(), self.OnSuggest)
wx.EVT_CHAR(self, self.OnChar)
wx.EVT_CHAR(self.replaceEntry, self.OnChar)
wx.EVT_CHAR(replaceBtn, self.OnChar)
wx.EVT_CHAR(addScriptBtn, self.OnChar)
wx.EVT_CHAR(skipBtn, self.OnChar)
wx.EVT_CHAR(addGlobalBtn, self.OnChar)
wx.EVT_CHAR(suggestBtn, self.OnChar)
util.finishWindow(self, vsizer)
self.showWord()
示例13: __init__
#.........这里部分代码省略.........
vsizer2.Add(hsizer, 0, wx.TOP, 5)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add(wx.StaticText(self, -1, "Alignment:"), 0,
wx.ALIGN_CENTER_VERTICAL)
self.alignCombo = wx.ComboBox(self, -1, style = wx.CB_READONLY)
for it in [ ("Left", util.ALIGN_LEFT), ("Center", util.ALIGN_CENTER),
("Right", util.ALIGN_RIGHT) ]:
self.alignCombo.Append(it[0], it[1])
hsizer.Add(self.alignCombo, 0, wx.LEFT, 10)
wx.EVT_COMBOBOX(self, self.alignCombo.GetId(), self.OnMisc)
vsizer2.Add(hsizer, 0, wx.TOP, 5)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add(wx.StaticText(self, -1, "Font:"), 0,
wx.ALIGN_CENTER_VERTICAL)
self.fontCombo = wx.ComboBox(self, -1, style = wx.CB_READONLY)
for it in [ ("Courier", pml.COURIER), ("Helvetica", pml.HELVETICA),
("Times-Roman", pml.TIMES_ROMAN) ]:
self.fontCombo.Append(it[0], it[1])
hsizer.Add(self.fontCombo, 0, wx.LEFT, 10)
wx.EVT_COMBOBOX(self, self.fontCombo.GetId(), self.OnMisc)
vsizer2.Add(hsizer, 0, wx.TOP, 10)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add(wx.StaticText(self, -1, "Size:"), 0,
wx.ALIGN_CENTER_VERTICAL)
self.sizeEntry = wx.SpinCtrl(self, -1)
self.sizeEntry.SetRange(4, 288)
wx.EVT_SPINCTRL(self, self.sizeEntry.GetId(), self.OnMisc)
wx.EVT_KILL_FOCUS(self.sizeEntry, self.OnKillFocus)
hsizer.Add(self.sizeEntry, 0, wx.LEFT, 10)
vsizer2.Add(hsizer, 0, wx.TOP, 5)
hsizerTop.Add(vsizer2)
bsizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Style"),
wx.HORIZONTAL)
vsizer2 = wx.BoxSizer(wx.VERTICAL)
# wxGTK adds way more space by default than wxMSW between the
# items, have to adjust for that
pad = 0
if misc.isWindows:
pad = 5
self.addCheckBox("Bold", self, vsizer2, pad)
self.addCheckBox("Italic", self, vsizer2, pad)
self.addCheckBox("Underlined", self, vsizer2, pad)
bsizer.Add(vsizer2)
hsizerTop.Add(bsizer, 0, wx.LEFT, 20)
vsizer.Add(hsizerTop, 0, wx.TOP, 10)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add((1, 1), 1)
self.previewBtn = gutil.createStockButton(self, "Preview")
hsizer.Add(self.previewBtn)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn, 0, wx.LEFT, 10)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 20)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, self.previewBtn.GetId(), self.OnPreview)
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
wx.EVT_LISTBOX(self, self.stringsLb.GetId(), self.OnStringsLb)
# list of widgets that are specific to editing the selected string
self.widList = [ self.textEntry, self.xEntry, self.alignCombo,
self.yEntry, self.fontCombo, self.sizeEntry,
self.boldCb, self.italicCb, self.underlinedCb ]
self.updateGui()
self.textEntry.SetFocus()
示例14: __init__
def __init__(self, parent, ctrl):
wx.Dialog.__init__(self, parent, -1, "Character name database",
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.ctrl = ctrl
hsizer = wx.BoxSizer(wx.HORIZONTAL)
vsizer = wx.BoxSizer(wx.VERTICAL)
vsizer.Add(wx.StaticText(self, -1, "Search in:"))
self.typeList = wx.ListCtrl(self, -1,
style = wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES)
self.typeList.InsertColumn(0, "Count")
self.typeList.InsertColumn(1, "Type")
for i in range(len(nameArr.typeNamesById)):
typeName = nameArr.typeNamesById[i]
self.typeList.InsertStringItem(i, str(nameArr.typeNamesCnt[typeName]))
self.typeList.SetStringItem(i, 1, typeName)
self.typeList.SetItemData(i, i)
self.typeList.SetColumnWidth(0, wx.LIST_AUTOSIZE)
self.typeList.SetColumnWidth(1, wx.LIST_AUTOSIZE)
w = 0
w += self.typeList.GetColumnWidth(0)
w += self.typeList.GetColumnWidth(1)
util.setWH(self.typeList, w + 15, 425)
self.typeList.SortItems(self.CmpFreq)
self.selectAllTypes()
vsizer.Add(self.typeList, 1, wx.EXPAND | wx.BOTTOM, 5)
selectAllBtn = wx.Button(self, -1, "Select all")
vsizer.Add(selectAllBtn)
hsizer.Add(vsizer, 0, wx.EXPAND)
vsizer = wx.BoxSizer(wx.VERTICAL)
hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
vsizer2 = wx.BoxSizer(wx.VERTICAL)
searchBtn = wx.Button(self, -1, "Search")
wx.EVT_BUTTON(self, searchBtn.GetId(), self.OnSearch)
vsizer2.Add(searchBtn, 0, wx.BOTTOM | wx.TOP, 10)
self.searchEntry = wx.TextCtrl(self, -1, style = wx.TE_PROCESS_ENTER)
vsizer2.Add(self.searchEntry, 0, wx.EXPAND)
tmp = wx.Button(self, -1, "Insert")
wx.EVT_BUTTON(self, tmp.GetId(), self.OnInsertName)
vsizer2.Add(tmp, 0, wx.BOTTOM | wx.TOP, 10)
hsizer2.Add(vsizer2, 1, wx.RIGHT, 10)
self.nameRb = wx.RadioBox(self, -1, "Name",
style = wx.RA_SPECIFY_COLS, majorDimension = 1,
choices = [ "begins with", "contains", "ends in" ])
hsizer2.Add(self.nameRb)
self.sexRb = wx.RadioBox(self, -1, "Sex",
style = wx.RA_SPECIFY_COLS, majorDimension = 1,
choices = [ "Male", "Female", "Both" ])
self.sexRb.SetSelection(2)
hsizer2.Add(self.sexRb, 0, wx.LEFT, 5)
vsizer.Add(hsizer2, 0, wx.EXPAND | wx.ALIGN_CENTER)
vsizer.Add(wx.StaticText(self, -1, "Results:"))
self.list = MyListCtrl(self)
vsizer.Add(self.list, 1, wx.EXPAND | wx.BOTTOM, 5)
self.foundLabel = wx.StaticText(self, -1, "",
style = wx.ALIGN_CENTRE | wx.ST_NO_AUTORESIZE)
vsizer.Add(self.foundLabel, 0, wx.EXPAND)
hsizer.Add(vsizer, 20, wx.EXPAND | wx.LEFT, 10)
wx.EVT_TEXT_ENTER(self, self.searchEntry.GetId(), self.OnSearch)
wx.EVT_BUTTON(self, selectAllBtn.GetId(), self.selectAllTypes)
wx.EVT_LIST_COL_CLICK(self, self.typeList.GetId(), self.OnHeaderClick)
util.finishWindow(self, hsizer)
self.OnSearch()
self.searchEntry.SetFocus()
示例15: __init__
#.........这里部分代码省略.........
gsizer.Add(wx.StaticText(self, -1, "Text to Find"), 0,
wx.ALIGN_CENTER_VERTICAL)
self.findEntry = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER)
gsizer.Add(self.findEntry, 0, wx.EXPAND)
gsizer.Add(wx.StaticText(self, -1, "Replace With"), 0,
wx.ALIGN_CENTER_VERTICAL)
self.replaceEntry = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER)
gsizer.Add(self.replaceEntry, 0, wx.EXPAND)
vsizer.Add(gsizer, 0, wx.EXPAND | wx.BOTTOM, 5)
hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
vsizer2 = wx.BoxSizer(wx.VERTICAL)
# wxGTK adds way more space by default than wxMSW between the
# items, have to adjust for that
pad = 0
if misc.isWindows:
pad = 5
self.matchWholeCb = wx.CheckBox(self, -1, "Match Whole Word")
vsizer2.Add(self.matchWholeCb, 0, wx.TOP, pad)
self.matchCaseCb = wx.CheckBox(self, -1, "Match Case")
vsizer2.Add(self.matchCaseCb, 0, wx.TOP, pad)
hsizer2.Add(vsizer2, 0, wx.EXPAND | wx.RIGHT, 10)
self.direction = wx.RadioBox(self, -1, "Direction",
choices=["Backward", "Forward"])
self.direction.SetSelection(1)
hsizer2.Add(self.direction, 1, 0)
vsizer.Add(hsizer2, 0, wx.EXPAND | wx.BOTTOM, 10)
self.extraLabel = wx.StaticText(self, -1, "Search In")
vsizer.Add(self.extraLabel)
self.elements = wx.CheckListBox(self, -1)
# sucky wxMSW doesn't support client data for checklistbox items,
# so we have to store it ourselves
self.elementTypes = []
for t in config.getTIs():
self.elements.Append(t.name)
self.elementTypes.append(t.lt)
vsizer.Add(self.elements, 1, wx.EXPAND)
hsizer.Add(vsizer, 1, wx.EXPAND)
vsizer = wx.BoxSizer(wx.VERTICAL)
find = wx.Button(self, -1, "&Find")
vsizer.Add(find, 0, wx.EXPAND | wx.BOTTOM, 5)
replaceAll = wx.Button(self, -1, " Replace All ")
vsizer.Add(replaceAll, 0, wx.EXPAND | wx.BOTTOM, 5)
replace = wx.Button(self, -1, "&Replace")
vsizer.Add(replace, 0, wx.EXPAND | wx.BOTTOM, 5)
self.moreButton = wx.Button(self, -1, "")
vsizer.Add(self.moreButton, 0, wx.EXPAND | wx.BOTTOM, 5)
hsizer.Add(vsizer, 0, wx.EXPAND | wx.LEFT, 30)
wx.EVT_BUTTON(self, find.GetId(), self.OnFind)
wx.EVT_BUTTON(self, replaceAll.GetId(), self.OnReplaceAll)
wx.EVT_BUTTON(self, replace.GetId(), self.OnReplace)
wx.EVT_BUTTON(self, self.moreButton.GetId(), self.OnMore)
gutil.btnDblClick(find, self.OnFind)
gutil.btnDblClick(replace, self.OnReplace)
wx.EVT_TEXT(self, self.findEntry.GetId(), self.OnText)
wx.EVT_TEXT_ENTER(self, self.findEntry.GetId(), self.OnFind)
wx.EVT_TEXT_ENTER(self, self.replaceEntry.GetId(), self.OnFind)
wx.EVT_CHAR(self, self.OnCharMisc)
wx.EVT_CHAR(self.findEntry, self.OnCharEntry)
wx.EVT_CHAR(self.replaceEntry, self.OnCharEntry)
wx.EVT_CHAR(find, self.OnCharButton)
wx.EVT_CHAR(replaceAll, self.OnCharButton)
wx.EVT_CHAR(replace, self.OnCharButton)
wx.EVT_CHAR(self.moreButton, self.OnCharButton)
wx.EVT_CHAR(self.matchWholeCb, self.OnCharMisc)
wx.EVT_CHAR(self.matchCaseCb, self.OnCharMisc)
wx.EVT_CHAR(self.direction, self.OnCharMisc)
wx.EVT_CHAR(self.elements, self.OnCharMisc)
util.finishWindow(self, hsizer, center=False)
self.loadState()
self.findEntry.SetFocus()