def InitUI(self):
self.panel = wx.Panel(self, wx.ID_ANY)
# Info Text
infotext = _(u'Close all open Applications, it is possible that programs will be closed without a warning '
u'and system could reboot without further confirmation.')
infobox = wx.StaticBox(self.panel, -1, _(u'Attention'))
infoboxbsizer = wx.StaticBoxSizer(infobox, wx.VERTICAL)
info = wx.StaticText(self.panel, label=infotext)
info.Wrap(380)
infoboxbsizer.Add(info, 0)
self.gauge = wx.Gauge(self.panel, size=(24, 26))
self.update_label = wx.StaticText(self.panel, label=_(u'Current Progress:'))
self.update_box = wx.TextCtrl(self.panel, style=wx.TE_READONLY)
self.update_box.SetBackgroundColour(wx.WHITE)
self.chk_shutdown = wx.CheckBox(self.panel, size=(160,20), label=_(u"Shutdown after update"))
self.logButton = wx.Button(self.panel, size=(54,26), label="LOG")
self.logButton.SetToolTip(wx.ToolTip(_(u'Open WPKG Log')))
self.logButton.SetBitmap(img.get('log'))
self.startButton = wx.Button(self.panel, label=_(u"Update"))
self.abortButton = wx.Button(self.panel, label=_(u"Cancel"))
self.logButton.Disable()
self.abortButton.Disable()
self.line = wx.StaticLine(self.panel, -1, size=(2,2), style=wx.LI_HORIZONTAL)
self.startButton.Bind(wx.EVT_BUTTON, self.OnStartButton)
self.abortButton.Bind(wx.EVT_BUTTON, self.OnAbortButton)
self.logButton.Bind(wx.EVT_BUTTON, self.OnLogButton)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add(infoboxbsizer, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.update_label, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.update_box, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.line, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.chk_shutdown, 0, wx.LEFT | wx.EXPAND, 7)
self.sizer2.Add(self.logButton, 0)
self.sizer2.AddStretchSpacer()
self.sizer2.Add(self.startButton, 0)#, wx.RIGHT, 2)
self.sizer2.Add(self.abortButton, 0)
self.sizer.Add(self.sizer2, 0, wx.ALL | wx.EXPAND, 5)
self.panel.SetSizerAndFit(self.sizer)
self.Center()
python类TE_READONLY的实例源码
def InitUI(self):
self.panel = wx.Panel(self, wx.ID_ANY)
# Info Text
infotext = _(u'Close all open Applications, it is possible that programs will be closed without a warning '
u'and system could reboot without further confirmation.')
infobox = wx.StaticBox(self.panel, -1, _(u'Attention'))
infoboxbsizer = wx.StaticBoxSizer(infobox, wx.VERTICAL)
info = wx.StaticText(self.panel, label=infotext)
info.Wrap(380)
infoboxbsizer.Add(info, 0)
self.gauge = wx.Gauge(self.panel, size=(24, 26))
self.update_label = wx.StaticText(self.panel, label=_(u'Current Progress:'))
self.update_box = wx.TextCtrl(self.panel, style=wx.TE_READONLY)
self.update_box.SetBackgroundColour(wx.WHITE)
self.chk_shutdown = wx.CheckBox(self.panel, size=(160,20), label=_(u"Shutdown after update"))
self.logButton = wx.Button(self.panel, size=(54,26), label="LOG")
self.logButton.SetToolTip(wx.ToolTip(_(u'Open WPKG Log')))
self.logButton.SetBitmap(img.get('log'))
self.startButton = wx.Button(self.panel, label=_(u"Update"))
self.abortButton = wx.Button(self.panel, label=_(u"Cancel"))
self.logButton.Disable()
self.abortButton.Disable()
self.line = wx.StaticLine(self.panel, -1, size=(2,2), style=wx.LI_HORIZONTAL)
self.startButton.Bind(wx.EVT_BUTTON, self.OnStartButton)
self.abortButton.Bind(wx.EVT_BUTTON, self.OnAbortButton)
self.logButton.Bind(wx.EVT_BUTTON, self.OnLogButton)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add(infoboxbsizer, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.update_label, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.update_box, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.line, 0, wx.ALL | wx.EXPAND, 5)
self.sizer.Add(self.chk_shutdown, 0, wx.LEFT | wx.EXPAND, 7)
self.sizer2.Add(self.logButton, 0)
self.sizer2.AddStretchSpacer()
self.sizer2.Add(self.startButton, 0)#, wx.RIGHT, 2)
self.sizer2.Add(self.abortButton, 0)
self.sizer.Add(self.sizer2, 0, wx.ALL | wx.EXPAND, 5)
self.panel.SetSizerAndFit(self.sizer)
self.Center()
def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"About", pos = wx.DefaultPosition, size = wx.Size( 800,512 ), style = wx.DEFAULT_DIALOG_STYLE )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
Sizer = wx.BoxSizer( wx.VERTICAL )
self.Panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
SizerC1 = wx.BoxSizer( wx.VERTICAL )
SizerText = wx.BoxSizer( wx.VERTICAL )
self.AppName = wx.StaticText( self.Panel, wx.ID_ANY, u"Turrican 2 Editor", wx.DefaultPosition, wx.DefaultSize, 0 )
self.AppName.Wrap( -1 )
self.AppName.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) )
SizerText.Add( self.AppName, 0, wx.LEFT|wx.RIGHT|wx.TOP, 8 )
self.AppVersion = wx.StaticText( self.Panel, wx.ID_ANY, u"Version 1.0.2", wx.DefaultPosition, wx.DefaultSize, 0 )
self.AppVersion.Wrap( -1 )
SizerText.Add( self.AppVersion, 0, wx.BOTTOM|wx.LEFT|wx.RIGHT, 8 )
self.License = wx.TextCtrl( self.Panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY|wx.NO_BORDER )
self.License.SetFont( wx.Font( 9, 75, 90, 90, False, "Courier New" ) )
self.License.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) )
SizerText.Add( self.License, 1, wx.ALL|wx.EXPAND, 8 )
SizerC1.Add( SizerText, 1, wx.EXPAND, 5 )
SizerButton = wx.BoxSizer( wx.HORIZONTAL )
SizerButton.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
self.Ok = wx.Button( self.Panel, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0 )
self.Ok.SetDefault()
SizerButton.Add( self.Ok, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
SizerC1.Add( SizerButton, 0, wx.EXPAND, 5 )
self.Panel.SetSizer( SizerC1 )
self.Panel.Layout()
SizerC1.Fit( self.Panel )
Sizer.Add( self.Panel, 1, wx.EXPAND |wx.ALL, 8 )
self.SetSizer( Sizer )
self.Layout()
self.Centre( wx.BOTH )
# Connect Events
self.Ok.Bind( wx.EVT_BUTTON, self.ok )
def GenerateSearchResultsTreeBranch(self, root, infos):
to_delete = []
if infos["name"] == "body":
item_name = "%d:" % infos["data"][1][0]
else:
item_name = infos["name"]
self.SearchResultsTree.SetItemText(root, item_name)
self.SearchResultsTree.SetPyData(root, infos["data"])
self.SearchResultsTree.SetItemBackgroundColour(root, wx.WHITE)
self.SearchResultsTree.SetItemTextColour(root, wx.BLACK)
if infos["type"] is not None:
if infos["type"] == ITEM_POU:
self.SearchResultsTree.SetItemImage(root, self.TreeImageDict[self.ParentWindow.Controler.GetPouType(infos["name"])])
else:
self.SearchResultsTree.SetItemImage(root, self.TreeImageDict[infos["type"]])
text = None
if infos["text"] is not None:
text = infos["text"]
start, end = infos["data"][1:3]
text_lines = infos["text"].splitlines()
start_idx = start[1]
end_idx = reduce(lambda x, y: x + y, map(lambda x: len(x) + 1, text_lines[:end[0] - start[0]]), end[1] + 1)
style = wx.TextAttr(wx.BLACK, wx.Colour(206, 204, 247))
elif infos["type"] is not None and infos["matches"] > 1:
text = _("(%d matches)") % infos["matches"]
start_idx, end_idx = 0, len(text)
style = wx.TextAttr(wx.Colour(0, 127, 174))
if text is not None:
text_ctrl_style = wx.BORDER_NONE | wx.TE_READONLY | wx.TE_RICH2
if wx.Platform != '__WXMSW__' or len(text.splitlines()) > 1:
text_ctrl_style |= wx.TE_MULTILINE
text_ctrl = wx.TextCtrl(id=-1, parent=self.SearchResultsTree, pos=wx.Point(0, 0),
value=text, style=text_ctrl_style)
width, height = text_ctrl.GetTextExtent(text)
text_ctrl.SetClientSize(wx.Size(width + 1, height))
text_ctrl.SetBackgroundColour(self.SearchResultsTree.GetBackgroundColour())
text_ctrl.Bind(wx.EVT_LEFT_DOWN, self.GetTextCtrlClickFunction(root))
text_ctrl.Bind(wx.EVT_LEFT_DCLICK, self.GetTextCtrlDClickFunction(root))
text_ctrl.SetInsertionPoint(0)
text_ctrl.SetStyle(start_idx, end_idx, style)
self.SearchResultsTree.SetItemWindow(root, text_ctrl)
if wx.VERSION >= (2, 6, 0):
item, root_cookie = self.SearchResultsTree.GetFirstChild(root)
else:
item, root_cookie = self.SearchResultsTree.GetFirstChild(root, 0)
for child in infos["children"]:
if item is None:
item = self.SearchResultsTree.AppendItem(root, "")
item, root_cookie = self.SearchResultsTree.GetNextChild(root, root_cookie)
self.GenerateSearchResultsTreeBranch(item, child)
item, root_cookie = self.SearchResultsTree.GetNextChild(root, root_cookie)
def __init__(self, *args, **kwds):
# begin wxGlade: sampoorna_win.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0)
self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY)
self.label_1 = wx.StaticText(self.panel_login, wx.ID_ANY, _("Warning: Always backup your database before you proceed to avoid potential data loss !!!"))
self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("This software does not save Sampoorna credentials. It is used for one time login"))
self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Username"))
self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER)
self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Password"))
self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER)
self.button_next = wx.Button(self.panel_login, wx.ID_ANY, _("Next >>"))
self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL)
self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("8 Standard"))
self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("9 Standard"))
self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("10 Standard"))
self.button_next_copy_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("<<Previous"))
self.button_next_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("Proceed >>"))
self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY)
self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, _("Progress"))
self.progresss_total = wx.TextCtrl(self.panel_2, wx.ID_ANY, "")
self.progress_each = wx.TextCtrl(self.panel_2, wx.ID_ANY, "")
self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, _("Status"))
self.text_ctrl_1 = wx.TextCtrl(self.panel_2, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER)
self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, _("Finished"))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TEXT_ENTER, self.on_password_enter, self.text_ctrl_passw)
self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next)
self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8)
self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9)
self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10)
self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_next_copy_copy)
self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_next_copy)
self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished)
# end wxGlade
def __init__(self, *args, **kwds):
# begin wxGlade: sampoorna_win.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0)
self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY)
self.label_1 = wx.StaticText(self.panel_login, wx.ID_ANY, ("Warning: Always backup your database before you proceed to avoid potential data loss !!!"))
self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, ("This software does not save Sampoorna credentials. It is used for one time login"))
self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, ("Sampoorna Username"))
self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER)
self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, ("Sampoorna Password"))
self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER)
self.button_next = wx.Button(self.panel_login, wx.ID_ANY, ("Next >>"))
self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL)
self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("8 Standard"))
self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("9 Standard"))
self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("10 Standard"))
self.button_previous = wx.Button(self.standard_pane, wx.ID_ANY, ("<<Previous"))
self.button_proceed = wx.Button(self.standard_pane, wx.ID_ANY, ("Proceed >>"))
self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY)
self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, ("Progress"))
self.progresss_total = wx.Gauge(self.panel_2, wx.ID_ANY, range=100)
self.label_progress_perc = wx.StaticText(self.panel_2, wx.ID_ANY, (""))
self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, ("Status"))
#self.list_ctrl_1 = wx.ListCtrl(self.panel_2, wx.ID_ANY, style=wx.LC_REPORT | wx.LC_ALIGN_LEFT | wx.SUNKEN_BORDER | wx.NO_BORDER)
self.text_ctrl_report = wx.TextCtrl(self.panel_2, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER)
self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, ("Abort"))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_passw)
self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_user)
self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next)
self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8)
self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9)
self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10)
self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_previous)
self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed)
self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished)
# create a pubsub receiver
Publisher().subscribe(self.update_display, "update")
Publisher().subscribe(self.final_report, "report")
Publisher().subscribe(self.update_progress_bar, "progress_bar")
Publisher().subscribe(self.update_current_class, "change_class")
# end wxGlade
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_TFRAME, name='TFrame', parent=prnt,
pos=wx.Point(254, 241), size=wx.Size(829, 786),
style=wx.DEFAULT_FRAME_STYLE, title=u'PAWS Terminal')
self._init_utils()
self.SetClientSize(wx.Size(821, 748))
self.SetMenuBar(self.TMenuBar)
self.SetAutoLayout(True)
self.SetToolTipString('TFrame')
self.SetMinSize(wx.Size(-1, 21))
self.TStatusBar = wx.StatusBar(id=wxID_TFRAMETSTATUSBAR,
name='TStatusBar', parent=self, style=0)
self.TStatusBar.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False,
u'Courier New'))
self._init_coll_TStatusBar_Fields(self.TStatusBar)
self.SetStatusBar(self.TStatusBar)
self.TInput = wx.TextCtrl(id=wxID_TFRAMETINPUT, name='TInput',
parent=self, pos=wx.Point(1, 728), size=wx.Size(819, 20),
style=wx.SIMPLE_BORDER | wx.TE_PROCESS_ENTER, value="''")
self.TInput.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False,
u'Courier'))
self.TInput.SetToolTipString(u'Type command here.')
self.TInput.SetAutoLayout(False)
self.TInput.SetEditable(True)
self.TInput.Enable(False)
self.TInput.Bind(wx.EVT_TEXT_ENTER, self.OnTInputTextEnter,
id=wxID_TFRAMETINPUT)
self.TDisplay = wx.TextCtrl(id=wxID_TFRAMETDISPLAY, name='TDisplay',
parent=self, pos=wx.Point(0, 0), size=wx.Size(821, 728),
style=wx.TE_RICH2 | wx.TE_MULTILINE | wx.TE_READONLY,
value=u'To run a game, choose File ? Pick Game … then choose a game from the list.')
self.TDisplay.SetMinSize(wx.Size(517, 440))
self.TDisplay.SetEditable(False)
self.TDisplay.SetToolTipString(u"Game's output displays here.")
self.TDisplay.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
u'Arial'))
self.TDisplay.Enable(True)
self._init_sizers()