def OnBrowseButtonClick(self, event):
# pop up the location browser dialog
dialog = BrowseLocationsDialog(self, self.VarType, self.Controller)
if dialog.ShowModal() == wx.ID_OK:
infos = dialog.GetValues()
else:
infos = None
dialog.Destroy()
if infos is not None:
location = infos["location"]
# set the location
if not infos["location"].startswith("%"):
dialog = wx.SingleChoiceDialog(
self,
_("Select a variable class:"),
_("Variable class"),
[_("Input"), _("Output"), _("Memory")],
wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
else:
selected = None
dialog.Destroy()
if selected is None:
self.Location.SetFocus()
return
if selected == 0:
location = "%I" + location
elif selected == 1:
location = "%Q" + location
else:
location = "%M" + location
self.Location.SetValue(location)
self.VarType = infos["IEC_type"]
self.Location.SetFocus()
python类DEFAULT_DIALOG_STYLE的实例源码
def AddJump(self):
if isinstance(self.SelectedElement, SFC_Step) and not self.SelectedElement.Output:
choices = []
for block in self.Blocks:
if isinstance(block, SFC_Step):
choices.append(block.GetName())
dialog = wx.SingleChoiceDialog(self.ParentWindow,
_("Add a new jump"),
_("Please choose a target"),
choices,
wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetStringSelection()
self.SelectedElement.AddOutput()
self.RefreshStepModel(self.SelectedElement)
step_connectors = self.SelectedElement.GetConnectors()
transition = self.CreateTransition(step_connectors["output"])
transition_connectors = transition.GetConnectors()
id = self.GetNewId()
jump = SFC_Jump(self, value, id)
pos = transition_connectors["output"].GetPosition(False)
jump.SetPosition(pos.x, pos.y + SFC_WIRE_MIN_SIZE)
self.AddBlock(jump)
self.Controler.AddEditedElementJump(self.TagName, id)
jump_connector = jump.GetConnector()
wire = self.ConnectConnectors(jump_connector, transition_connectors["output"])
transition.RefreshOutputPosition()
wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
self.RefreshJumpModel(jump)
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh(False)
dialog.Destroy()
def EditJumpContent(self, jump):
choices = []
for block in self.Blocks.itervalues():
if isinstance(block, SFC_Step):
choices.append(block.GetName())
dialog = wx.SingleChoiceDialog(self.ParentWindow,
_("Edit jump target"),
_("Please choose a target"),
choices,
wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
try:
indx = choices.index(jump.GetTarget())
dialog.SetSelection(indx)
except ValueError:
pass
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetStringSelection()
rect = jump.GetRedrawRect(1, 1)
jump.SetTarget(value)
rect = rect.Union(jump.GetRedrawRect())
self.RefreshJumpModel(jump)
self.RefreshBuffer()
self.RefreshScrollBars()
self.RefreshVisibleElements()
jump.Refresh(rect)
dialog.Destroy()
def __init__(self, parent, title, hist):
wx.Frame.__init__(self, parent, title=title, style = wx.DEFAULT_DIALOG_STYLE)
logopath = os.path.join(root_dir, 'data/logo.ico')
self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO))
if len(hist)==3:self.rgb(hist)
else: self.gray(hist)
def __init__(self, *args, **kwds):
# begin wxGlade: update_win.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.label_installed_version = wx.StaticText(self, wx.ID_ANY, ("Installed Version:"))
self.label_latest_version = wx.StaticText(self, wx.ID_ANY, ("Latest Version"))
self.label_is_update = wx.StaticText(self, wx.ID_ANY, ("If Update available"))
self.progress_bar = wx.Gauge(self, wx.ID_ANY, range=100)
self.animation_panel = wx.Panel(self, wx.ID_ANY)
self.label_status = wx.StaticText(self, wx.ID_ANY, (""))
self.button_close = wx.Button(self, wx.ID_ANY, ("Cancel"))
self.button_install = wx.Button(self, wx.ID_ANY, ("Check for Update"))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_close)
self.Bind(wx.EVT_BUTTON, self.on_install, self.button_install)
self.Bind(wx.EVT_CLOSE, self.on_close)
self.animation_panel.gif = None
# create a pubsub receiver
Publisher().subscribe(self.update, "update")
Publisher().subscribe(self.error_report, "error_report")
Publisher().subscribe(self.update_progress_bar, "progress_bar")
Publisher().subscribe(self.get_versions, "update_versions")
Publisher().subscribe(self.is_update, "is_update")
Publisher().subscribe(self.play_animation, "play_animation")
Publisher().subscribe(self.stop_animation, "stop_animation")
Publisher().subscribe(self.updation_successful, "updation_successful")
#self.play_animation('')
#wx.FutureCall(10, self.start_thread)
# end wxGlade
def __init__(self, *args, **kwds):
# grab the serial keyword and remove it from the dict
self.serial = kwds['serial']
del kwds['serial']
self.show = SHOW_ALL
if 'show' in kwds:
self.show = kwds.pop('show')
# begin wxGlade: SerialConfigDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.label_2 = wx.StaticText(self, -1, "Port")
self.choice_port = wx.Choice(self, -1, choices=[])
self.label_1 = wx.StaticText(self, -1, "Baudrate")
self.combo_box_baudrate = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN)
self.sizer_1_staticbox = wx.StaticBox(self, -1, "Basics")
self.panel_format = wx.Panel(self, -1)
self.label_3 = wx.StaticText(self.panel_format, -1, "Data Bits")
self.choice_databits = wx.Choice(self.panel_format, -1, choices=["choice 1"])
self.label_4 = wx.StaticText(self.panel_format, -1, "Stop Bits")
self.choice_stopbits = wx.Choice(self.panel_format, -1, choices=["choice 1"])
self.label_5 = wx.StaticText(self.panel_format, -1, "Parity")
self.choice_parity = wx.Choice(self.panel_format, -1, choices=["choice 1"])
self.sizer_format_staticbox = wx.StaticBox(self.panel_format, -1, "Data Format")
self.panel_timeout = wx.Panel(self, -1)
self.checkbox_timeout = wx.CheckBox(self.panel_timeout, -1, "Use Timeout")
self.text_ctrl_timeout = wx.TextCtrl(self.panel_timeout, -1, "")
self.label_6 = wx.StaticText(self.panel_timeout, -1, "seconds")
self.sizer_timeout_staticbox = wx.StaticBox(self.panel_timeout, -1, "Timeout")
self.panel_flow = wx.Panel(self, -1)
self.checkbox_rtscts = wx.CheckBox(self.panel_flow, -1, "RTS/CTS")
self.checkbox_xonxoff = wx.CheckBox(self.panel_flow, -1, "Xon/Xoff")
self.sizer_flow_staticbox = wx.StaticBox(self.panel_flow, -1, "Flow Control")
self.button_ok = wx.Button(self, wx.ID_OK, "")
self.button_cancel = wx.Button(self, wx.ID_CANCEL, "")
self.__set_properties()
self.__do_layout()
# end wxGlade
# attach the event handlers
self.__attach_events()
def __init__(self, parent, filetypes, fileLimit = None):
wx.Dialog.__init__(self, parent, -1, title = 'Select Input Files',
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.filetypes = {}
self.fileArray = wx.ListCtrl(self, -1, style = wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_HRULES | wx.LC_VRULES)
for i, (filetype, ext) in enumerate(filetypes):
self.fileArray.InsertColumn(i, filetype)
assert filetype not in self.filetypes, "Non-unique file identifiers! %s" % filetype
self.filetypes[filetype] = ext
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.getFile, self.fileArray)
self.goButton = wx.Button(self, -1, "Use Selected Files")
self.Bind(wx.EVT_BUTTON, self.complete, self.goButton)
self.Bind(wx.EVT_CLOSE, self.abort)
box = wx.BoxSizer(wx.VERTICAL)
box.Add(self.fileArray, 1, wx.ALL | wx.EXPAND, 10)
box.Add(self.goButton, 0, wx.ALL | wx.EXPAND, 10)
self.SetSizerAndFit(box)
self.SetSize(wx.Size(1200, 300))
self.Bind(wx.EVT_SIZE, self.resize)
for i in range(0, 10):
self.fileArray.Append([''] * self.fileArray.GetColumnCount())
self.resize(None)
self.CentreOnScreen()
def __init__(self, parent):
with iz.Dialog(init=self, title=u"Logon", orient=wx.VERTICAL, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER):
with iz.GridBagSizer(orient=wx.HORIZONTAL, proportion=1) as gb:
iz.StaticText(u"Username", border=10)
self._name = iz.TextCtrl(border=10, proportion=1, flag=wx.EXPAND).wx
iz.StaticText(u"Password", x=0, border=10)
self._pass = iz.TextCtrl(style=wx.TE_PASSWORD, border=10, proportion=1, flag=wx.EXPAND).wx
gb.AddGrowableCol(1)
with iz.StdDialogButtonSizer():
okbut = iz.Button(u"OK", id=wx.ID_OK).wx
iz.Button(u"Cancel", id=wx.ID_CANCEL)
insp = iz.Button(u"Help", id=wx.ID_HELP,border=10, EVT_BUTTON=InspectionTool().Show).wx
okbut.SetDefault()
self.Fit()
def __init__(
self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
style=wx.DEFAULT_DIALOG_STYLE, fields=None, data=None,
):
wx.Dialog.__init__ (self, parent, ID, title, pos, size, style)
sizer = wx.BoxSizer(wx.VERTICAL)
self.textctrls = {}
for field in fields:
box = wx.BoxSizer(wx.HORIZONTAL)
label = wx.StaticText(self, -1, field)
label.SetHelpText("This is the help text for the label")
box.Add(label, 1, wx.ALIGN_CENTRE|wx.ALL, 5)
text = wx.TextCtrl(self, -1, "", size=(80,-1))
text.SetHelpText("Here's some help text for field #1")
if field in data:
text.SetValue(repr(data[field]))
box.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL, 1)
sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 1)
self.textctrls[field] = text
line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)
btnsizer = wx.StdDialogButtonSizer()
btn = wx.Button(self, wx.ID_OK)
btn.SetHelpText("The OK button completes the dialog")
btn.SetDefault()
btnsizer.AddButton(btn)
btn = wx.Button(self, wx.ID_CANCEL)
btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)")
btnsizer.AddButton(btn)
btnsizer.Realize()
sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
self.SetSizer(sizer)
sizer.Fit(self)
def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"About", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
bSizer8 = wx.BoxSizer( wx.VERTICAL )
self.m_notebookAbout = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_panelAbout = wx.Panel( self.m_notebookAbout, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
bSizer10 = wx.BoxSizer( wx.VERTICAL )
bSizer10.AddSpacer( ( 0, 0), 1, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 5 )
self.m_staticTextAppNameVersion = wx.StaticText( self.m_panelAbout, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
self.m_staticTextAppNameVersion.Wrap( -1 )
bSizer10.Add( self.m_staticTextAppNameVersion, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )
self.m_staticTextCopyright = wx.StaticText( self.m_panelAbout, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
self.m_staticTextCopyright.Wrap( -1 )
bSizer10.Add( self.m_staticTextCopyright, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )
self.m_hyperlinkURL = wx.HyperlinkCtrl( self.m_panelAbout, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.HL_ALIGN_CENTRE|wx.HL_DEFAULT_STYLE )
bSizer10.Add( self.m_hyperlinkURL, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )
bSizer10.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
self.m_panelAbout.SetSizer( bSizer10 )
self.m_panelAbout.Layout()
bSizer10.Fit( self.m_panelAbout )
self.m_notebookAbout.AddPage( self.m_panelAbout, u"About", True )
bSizer8.Add( self.m_notebookAbout, 1, wx.EXPAND |wx.ALL, 5 )
self.m_buttonClose = wx.Button( self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0 )
bSizer8.Add( self.m_buttonClose, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )
self.SetSizer( bSizer8 )
self.Layout()
bSizer8.Fit( self )
self.Centre( wx.BOTH )
def __init__(self, parent, raw_header_str, caption,
pos=wx.DefaultPosition, size=(500,300),
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
self.parent = parent
wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
x, y = pos
if x == -1 and y == -1:
self.CenterOnScreen(wx.BOTH)
self.cur_selection = (0, 0)
self.raw_header_str = raw_header_str
self.raw_header_str_lower = raw_header_str.lower()
self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY)
font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False)
self.text.SetFont(font1)
self.text.SetInitialSize((600,400))
main_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5)
ok = wx.Button(self, wx.ID_OK, "OK")
ok.SetDefault()
ok.Bind(wx.EVT_BUTTON, self.on_close)
buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER)
self.search.ShowSearchButton(True)
self.search.ShowCancelButton(True)
# TODO: make layout of search & OK button prettier (OK should be right-aligned properly)
buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND)
buttons_sizer.Add((315, 0), 1, wx.EXPAND)
buttons_sizer.Add(ok, 0, wx.ALL)
main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4)
self.SetSizerAndFit(main_sizer)
self.set_cur_selection()
self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search)
self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search)
self.last_search_str = ''
self.last_find_index = 0
self.is_dialog_still_open = True
self.Bind(wx.EVT_CLOSE, self.on_close)
new_id = wx.NewId()
self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id)
self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
def __init__(self, parent, raw_header_str, caption,
pos=wx.DefaultPosition, size=(500,300),
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
self.parent = parent
wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
x, y = pos
if x == -1 and y == -1:
self.CenterOnScreen(wx.BOTH)
self.cur_selection = (0, 0)
self.raw_header_str = raw_header_str
self.raw_header_str_lower = raw_header_str.lower()
self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY)
font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False)
self.text.SetFont(font1)
self.text.SetInitialSize((600,400))
main_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5)
ok = wx.Button(self, wx.ID_OK, "OK")
ok.SetDefault()
ok.Bind(wx.EVT_BUTTON, self.on_close)
buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER)
self.search.ShowSearchButton(True)
self.search.ShowCancelButton(True)
# TODO: make layout of search & OK button prettier (OK should be right-aligned properly)
buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND)
buttons_sizer.Add((315, 0), 1, wx.EXPAND)
buttons_sizer.Add(ok, 0, wx.ALL)
main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4)
self.SetSizerAndFit(main_sizer)
self.set_cur_selection()
self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search)
self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search)
self.last_search_str = ''
self.last_find_index = 0
self.is_dialog_still_open = True
self.Bind(wx.EVT_CLOSE, self.on_close)
new_id = wx.NewId()
self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id)
self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Teardrops", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
bvs_main = wx.BoxSizer( wx.VERTICAL )
rbx_actionChoices = [ u"Set Teardrops", u"Remove All Teardrops" ]
self.rbx_action = wx.RadioBox( self, wx.ID_ANY, u"Action", wx.DefaultPosition, wx.DefaultSize, rbx_actionChoices, 1, wx.RA_SPECIFY_ROWS )
self.rbx_action.SetSelection( 0 )
bvs_main.Add( self.rbx_action, 0, wx.ALL, 5 )
gs_params = wx.GridSizer( 0, 2, 0, 0 )
self.st_hpercent = wx.StaticText( self, wx.ID_ANY, u"Horizontal percent", wx.DefaultPosition, wx.DefaultSize, 0 )
self.st_hpercent.Wrap( -1 )
gs_params.Add( self.st_hpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
self.sp_hpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 30 )
gs_params.Add( self.sp_hpercent, 0, wx.ALL|wx.SHAPED, 5 )
self.st_vpercent = wx.StaticText( self, wx.ID_ANY, u"Vertical percent", wx.DefaultPosition, wx.DefaultSize, 0 )
self.st_vpercent.Wrap( -1 )
gs_params.Add( self.st_vpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
self.sp_vpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 70 )
gs_params.Add( self.sp_vpercent, 0, wx.ALL|wx.SHAPED, 5 )
self.st_nbseg = wx.StaticText( self, wx.ID_ANY, u"Number of segments", wx.DefaultPosition, wx.DefaultSize, 0 )
self.st_nbseg.Wrap( -1 )
gs_params.Add( self.st_nbseg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
self.sp_nbseg = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
gs_params.Add( self.sp_nbseg, 0, wx.ALL|wx.SHAPED, 5 )
bvs_main.Add( gs_params, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND|wx.SHAPED, 5 )
bhs_modal = wx.BoxSizer( wx.HORIZONTAL )
bhs_modal.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
self.but_cancel = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
bhs_modal.Add( self.but_cancel, 0, wx.ALIGN_RIGHT|wx.EXPAND, 5 )
self.but_ok = wx.Button( self, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0 )
bhs_modal.Add( self.but_ok, 0, 0, 5 )
bvs_main.Add( bhs_modal, 0, wx.EXPAND, 5 )
self.SetSizer( bvs_main )
self.Layout()
bvs_main.Fit( self )
self.Centre( wx.BOTH )
def __init__(self, parent):
wx.Dialog.__init__(self, parent, title="Lookup Table", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
self.SetSizeHints(720,480,-1,-1)
self.parent = parent
self.Bind(wx.EVT_CLOSE, self.OnExit)
self.panelphase = parent.GetParent().GetPage(0)
self.panelvisual = self.GetParent()
self.actor_list3D = ["vtkOpenGLActor", "vtkActor", "vtkMesaActor"]
self.actor_list2D = ["vtkOpenGLImageActor", "vtkImageActor"]
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.hbox = wx.BoxSizer(wx.HORIZONTAL)
self.vbox1 = wx.BoxSizer(wx.VERTICAL)
self.vbox2 = wx.BoxSizer(wx.VERTICAL)
self.font = self.panelvisual.font
self.panels = []
self.listtitles = ["Real Amp","Real Phase", "Fourier Amp","Fourier Phase"]
self.list = wx.ListCtrl(self,wx.ID_ANY,style=wx.LC_REPORT|wx.LC_NO_HEADER|wx.LC_HRULES|wx.SUNKEN_BORDER, size=(200,-1))
self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelectListItem)
self.list.InsertColumn(0,'Settings', width = 200)
self.list.SetFont(self.font)
for i in range(len(self.listtitles)):
if IsNotWX4():
self.list.InsertStringItem(i,self.listtitles[i],i)
else:
self.list.InsertItem(i,self.listtitles[i],i)
self.list.SetItemFont(i, self.font)
self.panels.append(ColourDialog(self))
self.panels[-1].Hide()
self.panels[-1].Layout()
self.GetRadioChoice(i)
self.vbox2.Add(self.panels[-1], 1, wx.EXPAND)
self.vbox1.Add(self.list, 1, wx.EXPAND)
self.panel_hld = wx.StaticText(self, label='')
self.vbox2.Add(self.panel_hld, 1, wx.EXPAND)
self.hbox.Add(self.vbox1, 0, wx.EXPAND,2)
self.hbox.Add(self.vbox2, 1, wx.EXPAND,2)
self.sizer.Add(self.hbox, 1, wx.EXPAND,2)
self.button_update = wx.Button(self, label="Update Scale", size=(720, 30))
self.sizer.Add(self.button_update, 0, wx.EXPAND, 2)
self.Bind(wx.EVT_BUTTON, self.OnClickUpdate,self.button_update)
self.SetSizer(self.sizer)
self.Fit()
self.Layout()
self.Show()
def __init__(self, images, parent=None, id=wx.ID_ANY, title='CellStar explorer', x=900, y=600):
"""
@type images: ImageRepo
"""
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX
wx.Dialog.__init__(self, parent, id, title, style=style)
self.Size = (x, y)
self.figure = mpl.figure.Figure(dpi=300, figsize=(1, 1))
self.axes = self.figure.add_subplot(111)
self.axes.margins(0, 0)
self.canvas = Canvas(self, -1, self.figure)
self.toolbar = Toolbar(self.canvas)
self.toolbar.Realize()
self.abort = False
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.canvas, 1, wx.EXPAND)
sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
self.SetSizer(sizer)
self.layer0 = self.axes.imshow(images.image, cmap=mpl.cm.gray)
def onclick_internal(event):
if event.ydata is None:
return
print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f' % (
event.button, event.x, event.y, event.xdata, event.ydata)
if event.button != 1:
self.onclick(event.button, event.xdata, event.ydata)
self.figure.canvas.draw()
def press_internal(event):
print('press', event.key)
if event.key == 'b': # abort
self.EndModal(ExplorerFrame.ABORTED)
if event.key in 'qwerxcv':
self.layer0.remove()
if event.key == 'q': # input
self.layer0 = self.axes.imshow(images.image, cmap=mpl.cm.gray)
elif event.key == 'w': # image clean
self.layer0 = self.axes.imshow(images.image_back_difference, cmap=mpl.cm.gray)
elif event.key == 'x': # image clean
self.layer0 = self.axes.imshow(images.image_back_difference_blurred, cmap=mpl.cm.gray)
elif event.key == 'c': # image clean
self.layer0 = self.axes.imshow(images.foreground_mask, cmap=mpl.cm.gray)
elif event.key == 'v': # image clean
self.layer0 = self.axes.imshow(images.background_mask, cmap=mpl.cm.gray)
elif event.key == 'e': # brighter
self.layer0 = self.axes.imshow(images.brighter, cmap=mpl.cm.gray)
elif event.key == 'r': # darker
self.layer0 = self.axes.imshow(images.darker, cmap=mpl.cm.gray)
self.figure.canvas.draw()
else:
self.press(event.key)
self.figure.canvas.draw()
self.figure.canvas.mpl_connect('button_press_event', onclick_internal)
self.figure.canvas.mpl_connect('key_press_event', press_internal)
self.Show(True)
def __init__(self, parent):
super(DownloaderDialog, self).__init__(parent, title="pyjam Downloader",
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.parent = parent
self.audio_links = wx.TextCtrl(self)
audio_link_text = wx.StaticText(self, label="URL(s) (Separate with commas)")
self.out_dir = wx.DirPickerCtrl(self, path=os.path.abspath("downloads"))
out_dir_text = wx.StaticText(self, label="Output directory")
warning_text = wx.StaticText(self, style=wx.ALIGN_CENTRE_HORIZONTAL,
label=("Note: The program will freeze for a bit while it processes the URL "
"before downloading"))
warning_text.Wrap(self.GetSize()[0])
search_button = wx.Button(self, label="Search")
top_sizer = wx.BoxSizer(wx.VERTICAL)
control_sizer = wx.BoxSizer(wx.VERTICAL)
text_sizer = wx.BoxSizer(wx.VERTICAL)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
control_sizer.Add(audio_link_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
control_sizer.Add(self.audio_links, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
control_sizer.Add(out_dir_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
control_sizer.Add(self.out_dir, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
text_sizer.Add(warning_text, 0, wx.ALL | wx.ALIGN_CENTER, 5)
button_sizer.Add(search_button)
top_sizer.Add(control_sizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_TOP, 5)
top_sizer.Add(text_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)
top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)
self.Bind(wx.EVT_BUTTON, handler=self.on_ok, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, handler=lambda x: SearchDialog(self), source=search_button)
self.downloader = None
self.progress_dialog = None
self.num_songs = 0
self.SetSizerAndFit(top_sizer)
self.Center()
self.ShowModal()
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 _init_ctrls(self, prnt):
wx.Dialog.__init__(
self, id=ID_DISCOVERYDIALOG,
name='DiscoveryDialog', parent=prnt, style=wx.DEFAULT_DIALOG_STYLE,
title=_('Service Discovery'))
self.staticText1 = wx.StaticText(
id=ID_DISCOVERYDIALOGSTATICTEXT1,
label=_('Services available:'), name='staticText1', parent=self,
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
# Set up list control
self.ServicesList = AutoWidthListCtrl(
id=ID_DISCOVERYDIALOGSERVICESLIST,
name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0),
style=wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_SINGLE_SEL)
self.ServicesList.InsertColumn(0, _('NAME'))
self.ServicesList.InsertColumn(1, _('TYPE'))
self.ServicesList.InsertColumn(2, _('IP'))
self.ServicesList.InsertColumn(3, _('PORT'))
self.ServicesList.SetColumnWidth(0, 150)
self.ServicesList.SetColumnWidth(1, 150)
self.ServicesList.SetColumnWidth(2, 150)
self.ServicesList.SetColumnWidth(3, 150)
self.ServicesList.SetInitialSize(wx.Size(-1, 300))
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, id=ID_DISCOVERYDIALOGSERVICESLIST)
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, id=ID_DISCOVERYDIALOGSERVICESLIST)
listmix.ColumnSorterMixin.__init__(self, 4)
self.RefreshButton = wx.Button(
id=ID_DISCOVERYDIALOGREFRESHBUTTON,
label=_('Refresh'), name='RefreshButton', parent=self,
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.Bind(wx.EVT_BUTTON, self.OnRefreshButton, id=ID_DISCOVERYDIALOGREFRESHBUTTON)
self.LocalButton = wx.Button(
id=ID_DISCOVERYDIALOGLOCALBUTTON,
label=_('Local'), name='LocalButton', parent=self,
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.Bind(wx.EVT_BUTTON, self.OnLocalButton, id=ID_DISCOVERYDIALOGLOCALBUTTON)
self.IpButton = wx.Button(
id=ID_DISCOVERYDIALOGIPBUTTON,
label=_('Add IP'), name='IpButton', parent=self,
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.Bind(wx.EVT_BUTTON, self.OnIpButton, id=ID_DISCOVERYDIALOGIPBUTTON)
self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTER)
self._init_sizers()
self.Fit()
def __init__(self, parent, rate=None, out_dir=None, in_dir=None):
super(FFmpegConvertDialog, self).__init__(parent=parent, title="pyjam Audio Converter",
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.in_dir = in_dir
self.game_rate = intctrl.IntCtrl(self)
game_rate_text = wx.StaticText(self, label="Audio rate")
if rate is not None:
self.game_rate.SetValue(rate)
self.volume = wx.SpinCtrl(self, initial=85)
volume_text = wx.StaticText(self, label="Volume %")
self.in_picker = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL)
in_picker_text = wx.StaticText(self, label="Input file names (manually changing them has no effect)")
self.in_files = []
# the dumbest thing i've done all year (i'm overriding the controls of the PickerBase)
for child in self.in_picker.GetChildren():
if isinstance(child, wx.Button):
child.Bind(wx.EVT_BUTTON, self.browse)
self.out_dir = wx.DirPickerCtrl(self, name="Output directory")
out_dir_text = wx.StaticText(self, label="Output directory")
if out_dir is not None:
self.out_dir.SetPath(out_dir)
top_sizer = wx.BoxSizer(wx.VERTICAL)
top_row = wx.BoxSizer(wx.HORIZONTAL)
rate_sizer = wx.BoxSizer(wx.VERTICAL)
vol_sizer = wx.BoxSizer(wx.VERTICAL)
dir_sizer = wx.BoxSizer(wx.VERTICAL)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
rate_sizer.Add(game_rate_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
rate_sizer.Add(self.game_rate, 0, wx.ALL | wx.ALIGN_LEFT, 5)
vol_sizer.Add(volume_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
vol_sizer.Add(self.volume, 0, wx.ALL | wx.ALIGN_LEFT, 5)
top_row.Add(rate_sizer)
top_row.Add(vol_sizer)
dir_sizer.Add(in_picker_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
dir_sizer.Add(self.in_picker, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
dir_sizer.Add(out_dir_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
dir_sizer.Add(self.out_dir, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
top_sizer.Add(top_row)
top_sizer.Add(dir_sizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_TOP, 5)
top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)
self.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.on_cancel, id=wx.ID_CANCEL)
self.converter = None
self.progress_dialog = None
self.num_songs = 0
self.SetSizer(top_sizer)
# self.SetSize(400, 250)
self.Center()
self.ShowModal()