def InitUI(self):
#draw the pannel
wx.StaticText(self, label='Select elements to download to local storage', pos=(30, 5))
self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,30))
self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,55))
self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,80))
self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,105))
self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,130))
#right side
self.cb_all = wx.CheckBox(self, label='Back up\nWhole Pigrow Folder',pos = (270,75))
#progress bar
wx.StaticText(self, label='saving to; '+ localfiles_info_pnl.local_path, pos=(15, 155))
self.current_file_txt = wx.StaticText(self, label='--', pos=(30, 190))
self.current_dest_txt = wx.StaticText(self, label='--', pos=(30, 215))
#buttons
self.start_download_btn = wx.Button(self, label='Download files', pos=(40, 240), size=(175, 50))
self.start_download_btn.Bind(wx.EVT_BUTTON, self.start_download_click)
self.close_btn = wx.Button(self, label='Close', pos=(415, 240), size=(175, 50))
self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose)
## universal controls
pnl = wx.Panel(self)
python类StaticText()的实例源码
def __init__(self):
wx.Frame.__init__(self, None,
pos=wx.DefaultPosition, size=wx.Size(450, 100),
style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |
wx.CLOSE_BOX | wx.CLIP_CHILDREN,
title="BRUNO")
panel = wx.Panel(self)
ico = wx.Icon('boy.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(ico)
my_sizer = wx.BoxSizer(wx.VERTICAL)
lbl = wx.StaticText(panel,
label="Bienvenido Sir. How can I help you?")
my_sizer.Add(lbl, 0, wx.ALL, 5)
self.txt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER,
size=(400, 30))
self.txt.SetFocus()
self.txt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
my_sizer.Add(self.txt, 0, wx.ALL, 5)
panel.SetSizer(my_sizer)
self.Show()
speak.Speak('''Welcome back Sir, Broono at your service.''')
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(400, 250))
panel = wx.Panel(self, wx.ID_ANY)
panel.SetBackgroundColour('#000000')
text = """\n \t \t \t E-Z Music Downloader v1.0 \n \n Type in the song you want to downloading the the first box like so: "Song name by Artist" make sure you have both the artist and the song name in the query, in the second box type in what you want to name the Mp3. Next select High quality or Medium quality. High quality creates a larger file, therefore takes longer to convert. The status bar will show the actions the program is doing, once the status bar says done you can download another. To change the directory in which the song downloads, go to options in the menu bar and select "ChangeDownloadDirectory". \n \n \t \t Thanks for chosing E-Z Musick Downloader! \n \n \t (Songs converted using http://www.convertmemp3.com )"""
txt = wx.StaticText(panel, label=text)
txt.SetForegroundColour('#FFFFFF')
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(txt, 1, wx.EXPAND|wx.ALIGN_CENTER, 5)
panel.SetSizer(sizer)
self.Show()
self.Centre()
def __init__(self, parent, id, title, message, download_url, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog'):
wx.Dialog.__init__(self, parent, id, title, pos, size, style, name)
label = wx.StaticText(self, label=message)
button = wx.Button(self, id=wx.ID_OK, label="Close")
button.SetDefault()
line = wx.StaticLine(self, wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL)
download_ctrl = hl.HyperLinkCtrl(self, wx.ID_ANY, download_url, URL=download_url)
sizer = wx.BoxSizer(wx.VERTICAL)
button_sizer = wx.StdDialogButtonSizer()
button_sizer.AddButton(button)
button_sizer.Realize()
sizer.Add(label, 0, wx.ALIGN_CENTER|wx.ALL, 5)
sizer.Add(download_ctrl, 0, wx.ALL, 10)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)
sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
self.SetSizer(sizer)
sizer.Fit(self)
def __init__(self, parent=None, default_url=""):
wx.Panel.__init__(self, parent)
self._sizer = wx.BoxSizer(wx.HORIZONTAL)
self._url = wx.TextCtrl(self)
self._url.Bind(wx.EVT_KILL_FOCUS, self._field_changed)
self._url.SetValue(default_url)
self._status_label = ProcessingPlaceholderText(self)
label = wx.StaticText(self, label="Server URL")
label.SetToolTipString("URL for the IRIDA server API.")
self._sizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0)
self._sizer.Add(self._url, flag=wx.EXPAND, proportion=1)
self._sizer.Add(self._status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0)
self.SetSizerAndFit(self._sizer)
self.Layout()
self.Bind(wx.EVT_CLOSE, self._on_close)
pub.subscribe(self._status_label.SetError, APIConnectorTopics.connection_error_url_topic)
pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_topic)
pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_valid_url)
def _post_processing_task_started(self):
"""Show a 'processing' message on the UI while the post processing task is executing."""
pub.unsubscribe(self._post_processing_task_started, RunUploaderTopics.started_post_processing)
pub.subscribe(self._post_processing_task_completed, RunUploaderTopics.finished_post_processing)
pub.subscribe(self._post_processing_task_failed, RunUploaderTopics.failed_post_processing)
logging.info("Post-processing started, updating UI.")
self.Freeze()
self._post_processing_sizer = wx.BoxSizer(wx.HORIZONTAL)
self._post_processing_placeholder = ProcessingPlaceholderText(self)
self._post_processing_placeholder.SetFont(wx.Font(pointSize=18, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_BOLD, face="Segoe UI Symbol"))
self._post_processing_text = wx.StaticText(self, label="Executing post-processing task.")
self._post_processing_text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD))
self._post_processing_text.Wrap(350)
self._post_processing_text.SetToolTipString("Executing command `{}`.".format(read_config_option("completion_cmd")))
self._post_processing_sizer.Add(self._post_processing_text, flag=wx.RIGHT, border=5, proportion=1)
self._post_processing_sizer.Add(self._post_processing_placeholder, flag=wx.LEFT, border=5, proportion=0)
self._sizer.Insert(0, self._post_processing_sizer, flag=wx.EXPAND | wx.ALL, border=5)
self.Layout()
self.Thaw()
def __init__(self, parent, message, caption, choices=[]):
wx.Dialog.__init__(self, parent, -1)
self.SetTitle(caption)
sizer = wx.BoxSizer(wx.VERTICAL)
self.message = wx.StaticText(self, -1, message)
self.clb = wx.CheckListBox(self, -1, choices=choices)
self.chbox = wx.CheckBox(self, -1, 'Select all')
self.btns = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL)
self.Bind(wx.EVT_CHECKBOX, self.EvtChBox, self.chbox)
sizer.Add(self.message, 0, wx.ALL | wx.EXPAND, 5)
sizer.Add(self.clb, 1, wx.ALL | wx.EXPAND, 5)
sizer.Add(self.chbox, 0, wx.ALL | wx.EXPAND, 5)
sizer.Add(self.btns, 0, wx.ALL | wx.EXPAND, 5)
self.SetSizer(sizer)
# self.Fit()
def initGain(self):
gainSizer = wx.BoxSizer(orient=wx.VERTICAL)
gainControlBox = widgets.ControlBox(self, label='Gain', orient=wx.HORIZONTAL)
self.gainText = wx.StaticText(self, label='%0.2f' % self.pg.gain)
gainTextSizer = wx.BoxSizer(orient=wx.VERTICAL)
gainTextSizer.Add(self.gainText, proportion=1, flag=wx.EXPAND)
self.gainSlider = wx.Slider(self, style=wx.SL_HORIZONTAL,
value=int(self.pg.gain*100.0), minValue=1, maxValue=100)
self.Bind(wx.EVT_SLIDER, self.setGain, self.gainSlider)
gainControlBox.Add(gainTextSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=10)
gainControlBox.Add(self.gainSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10)
gainSizer.Add(gainControlBox,
flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
self.sizer.Add(gainSizer, proportion=0, flag=wx.EXPAND)
def initControls(self):
# slider for controlling the length of the spans in Welch's method
# since sliders are int, we use divide by 4 to get float value
spanControlBox = widgets.ControlBox(self, label='Span', orient=wx.HORIZONTAL)
self.spanText = wx.StaticText(self, label='%4.2f(s)' % self.pg.welchConfig.span)
spanTextSizer = wx.BoxSizer(orient=wx.VERTICAL)
spanTextSizer.Add(self.spanText, proportion=1,
flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=8)
self.spanSlider = wx.Slider(self, style=wx.SL_HORIZONTAL,
value=int(self.pg.welchConfig.span*4), minValue=1, maxValue=12)
spanControlBox.Add(spanTextSizer, proportion=0, flag=wx.TOP, border=10)
spanControlBox.Add(self.spanSlider, proportion=1,
flag=wx.ALL | wx.EXPAND, border=10)
self.Bind(wx.EVT_SLIDER, self.setSpan, self.spanSlider)
self.sizer.Add(spanControlBox, proportion=0,
flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
def initSigControls(self):
"""Initialize signal controls.
"""
sigSizer = wx.BoxSizer(orient=wx.VERTICAL)
scaleControlBox = widgets.ControlBox(self, label='Noise', orient=wx.VERTICAL)
self.scaleText = wx.StaticText(self, label='%4.1f' % self.src.scale.value)
scaleTextSizer = wx.BoxSizer(orient=wx.VERTICAL)
scaleTextSizer.Add(self.scaleText, proportion=1, flag=wx.EXPAND)
self.scaleSlider = wx.Slider(self, style=wx.SL_VERTICAL,
value=self.src.scale.value*10.0, minValue=1, maxValue=100)
self.Bind(wx.EVT_SLIDER, self.setScale, self.scaleSlider)
scaleControlBox.Add(scaleTextSizer, proportion=0,
flag=wx.ALL | wx.EXPAND, border=10)
scaleControlBox.Add(self.scaleSlider, proportion=1,
flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
sigSizer.Add(scaleControlBox, proportion=1,
flag=wx.ALL | wx.EXPAND, border=10)
self.sizer.Add(sigSizer, proportion=1, flag=wx.EXPAND)
def OnCloseFloatingPage(self, event):
event.Skip()
frame = event.GetEventObject()
page_title = frame.GetTitle()
page_contents = list(frame.GetChildren())[-1]
#self.InsertPage(frame.page_index, page_contents, page_title, select=True, bitmap=frame.bitmap, control=frame.control)
#self.InsertPage(frame.page_index, wx.StaticText(self, label='hello world'), page_title, select=True)#, bitmap=frame.bitmap, control=frame.control)
page_contents.Reparent(self)
wx.Yield() # report this bug XXX - idfah
self.InsertPage(frame.page_index, page_contents, page_title, select=True,
bitmap=frame.bitmap, control=frame.control)
if frame.control:
src_tabs, idx = self.FindTab(page_contents)
frame.control.Reparent(src_tabs)
frame.control.Hide()
frame.control = None
self.SetPageTextColour(frame.page_index, frame.text_colour)
def __init__(self, *args, **kwds):
# begin wxGlade: Dialog_snapshot.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
wx.Dialog.__init__(self, *args, **kwds)
self.label_1 = wx.StaticText(self, wx.ID_ANY, "Nombre:")
self.nombre_snap = wx.TextCtrl(self, wx.ID_ANY, "")
self.label_2 = wx.StaticText(self, wx.ID_ANY, u"Descripci\u00f3n:")
self.descripcion_snap = wx.TextCtrl(self, wx.ID_ANY, "")
self.checkbox_memory = wx.CheckBox(self, wx.ID_ANY, "memory")
self.checkbox_quiesce = wx.CheckBox(self, wx.ID_ANY, "quiesce")
self.snap_ok = wx.Button(self, wx.ID_OK, "OK")
self.snap_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
self.__set_properties()
self.__do_layout()
# end wxGlade
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
from wx.lib.floatcanvas.ScreenShot import getScreenShotBitmap
note1 = wx.StaticText(self, -1, errorText)
note2 = wx.StaticText(self, -1, "This is what the FloatCanvas can look like:")
S = wx.BoxSizer(wx.VERTICAL)
S.Add((10, 10), 1)
S.Add(note1, 0, wx.ALIGN_CENTER)
S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 4)
S.Add(wx.StaticBitmap(self,-1,getScreenShotBitmap()),0,wx.ALIGN_CENTER)
S.Add((10, 10), 1)
self.SetSizer(S)
self.Layout()
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
note1 = wx.StaticText(self, -1, "The FloatCanvas Demo needs")
note2 = wx.StaticText(self, -1, "a separate frame")
b = wx.Button(self, -1, "Open Demo Frame Now")
b.Bind(wx.EVT_BUTTON, self.OnButton)
S = wx.BoxSizer(wx.VERTICAL)
S.Add((10, 10), 1)
S.Add(note1, 0, wx.ALIGN_CENTER)
S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5)
S.Add(b, 0, wx.ALIGN_CENTER | wx.ALL, 5)
S.Add((10, 10), 1)
self.SetSizer(S)
self.Layout()
def makeSettings(self, settingsSizer):
# Translators: This is the static text of the Quick Profile Wizard dialog.
msgIntro=_("Choose which options you want to reset to the default value for the Lambdas profile")
self.introStxt=wx.StaticText(self,-1,label=msgIntro)
settingsSizer.Add(self.introStxt,flag=wx.BOTTOM)
# Translators: This is the label for a checkbox in the
# Quick Profile Wizard dialog.
self.defaultTranslationTableCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Keep the LAMBDA braille table for the current language (%s)") % TABLE_NAME)
self.defaultTranslationTableCheckBox.SetValue(True)
settingsSizer.Add(self.defaultTranslationTableCheckBox,border=10,flag=wx.BOTTOM)
# Translators: This is the label for a checkbox in the
# Quick Profile Wizard dialog.
self.brailleTetherToFocusCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Set the braille cursor to tether the focus"))
self.brailleTetherToFocusCheckBox.SetValue(True)
settingsSizer.Add(self.brailleTetherToFocusCheckBox,border=10,flag=wx.BOTTOM)
# Translators: This is the label for a checkbox in the
# Quick Profile Wizard dialog.
self.disableReadByParagraphCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Disable the Braille reading by paragraph"))
self.disableReadByParagraphCheckBox.SetValue(True)
settingsSizer.Add(self.disableReadByParagraphCheckBox,border=10,flag=wx.BOTTOM)
# Translators: This is the label for a checkbox in the
# Quick Profile Wizard dialog.
self.disableBrailleWordWrapCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Disable word wrappping of the braille line"))
self.disableBrailleWordWrapCheckBox.SetValue(True)
settingsSizer.Add(self.disableBrailleWordWrapCheckBox,border=10,flag=wx.BOTTOM)
def __init__(self, *args, **kwds):
# begin wxGlade: LogicalVolumeDialog.__init__
wx.Dialog.__init__(self, *args, **kwds)
self.panel_1 = wx.Panel(self, wx.ID_ANY)
self.panel_4 = wx.Panel(self, wx.ID_ANY)
self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Select Logical Volume: "), style=wx.ALIGN_CENTER_HORIZONTAL)
self.panel_7 = wx.Panel(self, wx.ID_ANY)
self.combo_logical_volumes = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
self.panel_8 = wx.Panel(self, wx.ID_ANY)
self.panel_3 = wx.Panel(self, wx.ID_ANY)
self.panel_5 = wx.Panel(self, wx.ID_ANY)
self.button_select = wx.Button(self, wx.ID_OK, _("Select"))
self.panel_9 = wx.Panel(self, wx.ID_ANY)
self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
self.panel_6 = wx.Panel(self, wx.ID_ANY)
self.panel_2 = wx.Panel(self, wx.ID_ANY)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.button_select_click, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.button_cancel_click, id=wx.ID_CANCEL)
# end wxGlade
self.PopulateVolumes()
def __init__( self, parent ):
win_height = parent.GetSize()[1]
height_of_pannels_above = 230
space_left = win_height - height_of_pannels_above
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL )
# Start drawing the UI elements
wx.StaticText(self, label='Pigrow Config', pos=(25, 10))
self.update_config_btn = wx.Button(self, label='read config from pigrow', pos=(15, 60), size=(175, 30))
self.update_config_btn.Bind(wx.EVT_BUTTON, self.update_config_click)
self.name_box_btn = wx.Button(self, label='change box name', pos=(15, 95), size=(175, 30))
self.name_box_btn.Bind(wx.EVT_BUTTON, self.name_box_click)
self.config_lamp_btn = wx.Button(self, label='config lamp', pos=(15, 130), size=(175, 30))
self.config_lamp_btn.Bind(wx.EVT_BUTTON, self.config_lamp_click)
self.config_dht_btn = wx.Button(self, label='config dht', pos=(15, 165), size=(175, 30))
self.config_dht_btn.Bind(wx.EVT_BUTTON, self.config_dht_click)
self.new_gpio_btn = wx.Button(self, label='Add new relay device', pos=(15, 200), size=(175, 30))
self.new_gpio_btn.Bind(wx.EVT_BUTTON, self.add_new_device_relay)
self.update_settings_btn = wx.Button(self, label='update pigrow settings', pos=(15, 235), size=(175, 30))
self.update_settings_btn.Bind(wx.EVT_BUTTON, self.update_setting_click)
def __init__( self, parent ):
win_height = parent.GetSize()[1]
win_width = parent.GetSize()[0]
w_space_left = win_width - 285
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL )
## Draw UI elements
png = wx.Image('./config_info.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
#SDcard details
config_info_pnl.boxname_text = wx.TextCtrl(self, pos=(25, 150), size=(265,65))
config_info_pnl.location_text = wx.StaticText(self, label='locations', pos=(520, 120), size=(200,30))
config_info_pnl.config_text = wx.StaticText(self, label='config', pos=(520, 185), size=(200,30))
config_info_pnl.lamp_text = wx.StaticText(self, label='lamp', pos=(10, 330), size=(200,30))
config_info_pnl.dht_text = wx.StaticText(self, label='dht', pos=(10, 415), size=(200,30))
config_info_pnl.gpio_table = self.GPIO_list(self, 1)
config_info_pnl.gpio_table.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_GPIO)
def __init__( self, parent ):
win_height = parent.GetSize()[1]
height_of_pannels_above = 230
space_left = win_height - height_of_pannels_above
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL )
wx.StaticText(self, label='Cron Config Menu', pos=(25, 10))
self.read_cron_btn = wx.Button(self, label='Read Crontab', pos=(10, 40), size=(175, 30))
self.read_cron_btn.Bind(wx.EVT_BUTTON, self.read_cron_click)
self.new_cron_btn = wx.Button(self, label='New cron job', pos=(10, 80), size=(175, 30))
self.new_cron_btn.Bind(wx.EVT_BUTTON, self.new_cron_click)
self.update_cron_btn = wx.Button(self, label='Update Cron', pos=(10, 120), size=(175, 30))
self.update_cron_btn.Bind(wx.EVT_BUTTON, self.update_cron_click)
self.SetBackgroundColour('sea green') #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS
bSizer = wx.BoxSizer(wx.VERTICAL)
bSizer.Add(self.read_cron_btn, 0, wx.ALL, 5)
bSizer.Add(self.new_cron_btn, 0, wx.ALL, 5)
bSizer.Add(self.update_cron_btn, 0, wx.ALL, 5)
self.SetSizer(bSizer)
def __init__( self, parent ):
#find size
win_height = parent.GetSize()[1]
win_width = parent.GetSize()[0]
w_space_left = win_width - 285
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL )
wx.StaticText(self, label='Cron start up;', pos=(5, 10))
cron_list_pnl.startup_cron = self.startup_cron_list(self, 1, pos=(5, 40), size=(w_space_left-10, 200))
cron_list_pnl.startup_cron.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_startup)
wx.StaticText(self, label='Repeating Jobs;', pos=(5,245))
cron_list_pnl.repeat_cron = self.repeating_cron_list(self, 1, pos=(5, 280), size=(w_space_left-10, 200))
cron_list_pnl.repeat_cron.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_repeat)
wx.StaticText(self, label='One time triggers;', pos=(5,500))
cron_list_pnl.timed_cron = self.other_cron_list(self, 1, pos=(5, 530), size=(w_space_left-10, 200))
cron_list_pnl.timed_cron.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_timed)
# TESTING CODE WHILE SCRIPT WRITING IS IN PROGRESS
self.SetBackgroundColour('sea green') ###THIS IS JUST TO TEST SIZE REMOVE TO STOP THE UGLY
def InitUI(self):
#draw the pannel
wx.StaticText(self, label='Select elements to upload from local storage to pi\n\n ** Warning this will overwrite current pigrow files \n which may result in loss of data **', pos=(30, 5))
self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,90))
self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,115))
self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,140))
self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,165))
self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,190))
#right side
self.cb_all = wx.CheckBox(self, label='Restore Back up\nof whole Pigrow Folder',pos = (270,130))
#progress bar
wx.StaticText(self, label='uploading from; '+ localfiles_info_pnl.local_path, pos=(15, 215))
self.current_file_txt = wx.StaticText(self, label='--', pos=(30, 245))
self.current_dest_txt = wx.StaticText(self, label='--', pos=(30, 270))
#buttons
self.start_upload_btn = wx.Button(self, label='Upload files', pos=(40, 300), size=(175, 50))
self.start_upload_btn.Bind(wx.EVT_BUTTON, self.start_upload_click)
self.close_btn = wx.Button(self, label='Close', pos=(415, 300), size=(175, 50))
self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose)
## universal controls
pnl = wx.Panel(self)
def __init__( self, parent ):
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0,0), size = wx.Size( 285,190 ), style = wx.TAB_TRAVERSAL )
self.SetBackgroundColour((150,230,170)) #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS
pi_link_pnl.target_ip = ''
pi_link_pnl.target_user = ''
pi_link_pnl.target_pass = ''
pi_link_pnl.config_location_on_pi = '/home/pi/Pigrow/config/pigrow_config.txt'
## the three boxes for pi's connection details, IP, Username and Password
self.l_ip = wx.StaticText(self, label='address', pos=(10, 20))
self.tb_ip = wx.TextCtrl(self, pos=(125, 25), size=(150, 25))
self.tb_ip.SetValue("192.168.1.")
self.l_user = wx.StaticText(self, label='Username', pos=(10, 60))
self.tb_user = wx.TextCtrl(self, pos=(125, 60), size=(150, 25))
self.tb_user.SetValue("pi")
self.l_pass = wx.StaticText(self, label='Password', pos=(10, 95))
self.tb_pass = wx.TextCtrl(self, pos=(125, 95), size=(150, 25))
self.tb_pass.SetValue("raspberry")
## link with pi button
self.link_with_pi_btn = wx.Button(self, label='Link to Pi', pos=(10, 125), size=(175, 30))
self.link_with_pi_btn.Bind(wx.EVT_BUTTON, self.link_with_pi_btn_click)
self.link_status_text = wx.StaticText(self, label='-- no link --', pos=(25, 160))
## seek next pi button
self.seek_for_pigrows_btn = wx.Button(self, label='Seek next', pos=(190,125))
self.seek_for_pigrows_btn.Bind(wx.EVT_BUTTON, self.seek_for_pigrows_click)
def __init__(self, parent):
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
vbox = wx.BoxSizer(wx.VERTICAL)
title = StaticTextNew(self, label="Bin Numpy Array")
title.SetToolTipNew("Input array will be binned "+os.linesep+"according to the values below.")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.input_filename = TextPanelObject(self, "Input File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.output_filename = TextPanelObject(self, "Output File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
title2 = wx.StaticText(self, label="Bin dimensions: ")
vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.bdims=[{} for i in range(3)]
self.bdims[0] = SpinnerObject(self,"x",MAX_INT_16,1,1,1,20,60)
self.bdims[1] = SpinnerObject(self,"y",MAX_INT_16,1,1,1,20,60)
self.bdims[2] = SpinnerObject(self,"z",MAX_INT_16,1,1,1,20,60)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(self.bdims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
hbox.Add(self.bdims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
hbox.Add(self.bdims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
vbox.Add(hbox, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self, parent):
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
vbox = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, label="Filter array with median filter.")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.input_filename = TextPanelObject(self, "Input File: ", "",150,'*.npy')
vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,'*.npy')
vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
title2 = wx.StaticText(self, label="Filter kernel dimensions: ")
vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.kdims=[{} for i in range(3)]
self.kdims[0] = SpinnerObject(self,"x",MAX_INT_16,1,1,3,20,60)
self.kdims[1] = SpinnerObject(self,"y",MAX_INT_16,1,1,3,20,60)
self.kdims[2] = SpinnerObject(self,"z",MAX_INT_16,1,1,1,20,60)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(self.kdims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
hbox.Add(self.kdims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
hbox.Add(self.kdims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
vbox.Add(hbox, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.maxdev = SpinnerObject(self,"Normal deviation:",MAX_INT_16,0.0,0.1,0.5,150,150)
self.maxdev.label.SetToolTipNew("Maximum element-wise normal deviation.")
vbox.Add(self.maxdev, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self,parent):
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
vbox = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, label="Numpy array with coordinates to VTK array")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.input_filename = TextPanelObject(self, "Input file: ", "input.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
vbox.Add((-1, 5))
self.coords_filename = TextPanelObject(self, "Co-ord's file: ", "coordinates.npy",150,'*.npy')
vbox.Add(self.coords_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
vbox.Add((-1, 5))
self.output_filename = TextPanelObject(self, "Output file: ", "output.vtk",150,"VTK files (*.vtk)|*.vtk|All files (*.*)|*.*")
vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
vbox.Add((-1, 5))
self.rbampphase = wx.RadioBox(self, label="Type", choices=['Amplitude','Phase'], majorDimension=2, style=wx.RA_SPECIFY_COLS)
vbox.Add(self.rbampphase,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self, parent):
self.start_iter = None
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
vbox = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, label="HIO Algorithm")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10))
self.chkbox_sqrt_expamps.SetValue(True)
vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5)
self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.")
vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.beta = SpinnerObject(self,"Beta: ",1.0,0.0,0.01,0.9,100,100)
vbox.Add(self.beta, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100)
vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self, parent):
self.start_iter = None
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
vbox = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, label="ER Algorithm")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10))
self.chkbox_sqrt_expamps.SetValue(True)
vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5)
self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.")
vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
#self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
#vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100)
vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self, parent):
self.start_iter = None
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
vbox = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, label="Phase-Only Algorithm")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10))
self.chkbox_sqrt_expamps.SetValue(True)
vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5)
self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.")
vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100)
vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self, parent):
self.start_iter = None
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
vbox = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, label="HIO Algorithm with positivity constraint")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10))
self.chkbox_sqrt_expamps.SetValue(True)
vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5)
self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.")
vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.beta = SpinnerObject(self,"Beta: ",1.0,0.0,0.01,0.9,100,100)
vbox.Add(self.beta, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100)
vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self, parent):
"""Constructor"""
self.notUseDetaul = None
wx.Panel.__init__(self, parent=parent, size = (500,800))
B = wx.StaticBox(self, -1)
BSizer = wx.StaticBoxSizer(B, wx.VERTICAL)
self.imagesDir = os.path.join(".", "images")
self.screenShotDir = os.path.join(".", "screenShot")
self.defaultScreenShotImage = wx.Image(os.path.join(self.imagesDir, "default.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.screenShot = wx.StaticBitmap(self,-1, self.defaultScreenShotImage)
self.screenShot.Bind(wx.EVT_LEFT_DOWN, self.DrawOrReloadAll)
self.statusBar = wx.StaticText(self, -1, "")
BSizer.Add(self.statusBar)
BSizer.Add(self.screenShot,5,wx.EXPAND, 5)
self.SetSizer(BSizer)
pub.subscribe(self.updateStatus, "update")
pub.subscribe(self.DrawFromSelectedNode, "DrawFromSelectedNode")
pub.subscribe(self.DoSwipeOrInput, "DoSwipeOrInput")
self.hasDrew = False