def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Encrypted Files", pos = wx.DefaultPosition, size = wx.Size( 600,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
BodySizer = wx.BoxSizer( wx.VERTICAL )
self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
TextCtrlSizer = wx.BoxSizer( wx.VERTICAL )
self.EncryptedFilesTextCtrl = wx.TextCtrl( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY )
TextCtrlSizer.Add( self.EncryptedFilesTextCtrl, 1, wx.ALL|wx.EXPAND, 5 )
self.m_panel4.SetSizer( TextCtrlSizer )
self.m_panel4.Layout()
TextCtrlSizer.Fit( self.m_panel4 )
BodySizer.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 )
self.SetSizer( BodySizer )
self.Layout()
self.Centre( wx.BOTH )
python类Panel()的实例源码
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)
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()
wxPython_Wallpaper.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def __init__(self, parent):
wx.Panel.__init__(self, parent)
imageFile = 'Tile.bmp'
self.bmp = wx.Bitmap(imageFile)
# react to a resize event and redraw image
parent.Bind(wx.EVT_SIZE, self.canvasCallback)
menu = wx.Menu()
menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
menu.AppendSeparator()
menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
menuBar = wx.MenuBar()
menuBar.Append(menu, "File")
parent.SetMenuBar(menuBar)
self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)
button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)
parent.CreateStatusBar()
wxPython_OpenGL_GUI.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def __init__(self, parent):
wx.Panel.__init__(self, parent)
menu = wx.Menu()
menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
menu.AppendSeparator()
menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
menuBar = wx.MenuBar()
menuBar.Append(menu, "File")
parent.SetMenuBar(menuBar)
self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)
button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)
parent.CreateStatusBar()
def __init__(self, parent, browser,model = None):
wx.Panel.__init__(self, parent, -1)
panel = wx.Panel(self, -1)
self.dvc = dv.DataViewCtrl(self,
style=wx.BORDER_THEME
| dv.DV_ROW_LINES #
| dv.DV_VERT_RULES
| dv.DV_MULTIPLE
)
self.Sizer = wx.BoxSizer(wx.VERTICAL)
self.Sizer.Add(self.dvc, 1, wx.EXPAND)
self.browser = browser
self.WindowsSize = wx.GetClientDisplayRect()
if self.browser:
self.browser.set_window_size(self.WindowsSize[2]/2, (self.WindowsSize[3]))
self.browser.set_window_position(self.WindowsSize[2]/2, 0)
self.dvc.Bind(dv.EVT_DATAVIEW_ITEM_ACTIVATED, self.OnOpenGooleChrome)
self.dvc.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.OnSelectionChanged)
self.url = ""
def __init__(self, parent,nbresult,lf,rt):
wx.Panel.__init__(self, parent, -1)
panel = wx.Panel(self, -1)
self.nbResult = nbresult
self.lf = lf
self.rt = rt
hbox1 = wx.BoxSizer(wx.HORIZONTAL)
self.UrlTxtCtrl = wx.TextCtrl(self, -1, "http://news.china.com.cn", style = wx.TE_PROCESS_ENTER)
btnStart = wx.Button(self, -1, "?", (20,20))
#¼
#Onstart = frame.OnStart
self.Bind(wx.EVT_BUTTON, self.OnStart, btnStart)
hbox1.Add(self.UrlTxtCtrl, 1, wx.EXPAND)
hbox1.Add(btnStart,0, wx.EXPAND)
self.SetSizer(hbox1)
def __init__(self, parent,start):
wx.Panel.__init__(self, parent, -1)
self.start = start
panel = wx.Panel(self, -1)
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
self.NumTxtCtrl = wx.TextCtrl(self, -1, " ?v0.1.4", style = wx.TE_PROCESS_ENTER|wx.TE_READONLY)
self.severule = wx.Button(self, -1, "" ,(20,20))
self.btnClear = wx.Button(self, -1, "?" ,(20,20))
self.btnParseURL = wx.Button(self, -1, "URL" ,(20,20))
self.btnParseContent = wx.Button(self, -1, "?" ,(20,20))
#sizer
hbox2.Add(self.NumTxtCtrl,1, wx.EXPAND)
hbox2.Add(self.severule,0, wx.EXPAND)
hbox2.Add(self.btnClear,0, wx.EXPAND)
hbox2.Add(self.btnParseURL,0, wx.EXPAND)
hbox2.Add(self.btnParseContent,0, wx.EXPAND)
self.SetSizer(hbox2)
##?¼
self.Bind(wx.EVT_BUTTON, self.start.OnRemoveCache, self.btnClear)
self.Bind(wx.EVT_BUTTON, self.start.OnSeveResult, self.severule)
self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseURL)
self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseContent)
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 __init__(self, parent=None, default_directory="", monitor_directory=False):
wx.Panel.__init__(self, parent)
self._sizer = wx.BoxSizer(wx.HORIZONTAL)
directory_label = wx.StaticText(self, label="Default directory")
directory_label.SetToolTipString("Default directory to scan for uploads")
self._sizer.Add(directory_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0)
directory = wx.DirPickerCtrl(self, path=default_directory)
self.Bind(wx.EVT_DIRPICKER_CHANGED, lambda evt: send_message(SettingsDialog.field_changed_topic, field_name="default_dir", field_value=directory.GetPath()))
self._sizer.Add(directory, flag=wx.EXPAND, proportion=1)
monitor_checkbox = wx.CheckBox(self, label="Monitor directory for new runs?")
monitor_checkbox.SetValue(monitor_directory)
monitor_checkbox.SetToolTipString("Monitor the default directory for when the Illumina Software indicates that the analysis is complete and ready to upload (when CompletedJobInfo.xml is written to the directory).")
monitor_checkbox.Bind(wx.EVT_CHECKBOX, lambda evt: send_message(SettingsDialog.field_changed_topic, field_name="monitor_default_dir", field_value=str(monitor_checkbox.GetValue())))
self._sizer.Add(monitor_checkbox, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=5, proportion=0)
self.SetSizerAndFit(self._sizer)
self.Layout()
def __init__(self, size=(300, 300), pos=(100, 100)):
wx.Frame.__init__(self, None, title="Am I transparent?",
style=wx.SIMPLE_BORDER | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR)
self.SetClientSize(size)
self.SetPosition(pos)
self.alphaValue = 220
self.alphaIncrement = -4
pnl = wx.Panel(self)
# self.changeAlpha_timer = wx.Timer(self)
# self.changeAlpha_timer.Start(50)
# self.Bind(wx.EVT_TIMER, self.ChangeAlpha)
self.MakeTransparent(self.alphaValue)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
def __init__(self, *args, **kwargs):
"""Construct a new panel containing configuration widgets.
Args:
parent: Parent in wx hierarchy.
pg: Page to be configured.
*args, **kwargs: Additional arguments passed
to the wx.Panel base class.
"""
StandardConfigPanel.__init__(self, *args, **kwargs)
self.initMediaPath()
self.initNTrial()
self.initIntervals()
self.initSegWindow()
self.initClassifierKind()
self.initStandardLayout()
def __init__(self, parent, pg, *args, **kwargs):
"""Construct a new panel containing configuration widgets.
Args:
parent: Parent in wx hierarchy.
pg: Page to be configured.
*args, **kwargs: Additional arguments passed
to the wx.Panel base class.
"""
StandardConfigPanel.__init__(self, parent=parent, pg=pg, *args, **kwargs)
self.initCopy()
self.initNTrial()
self.initIntervals()
self.initSegWindow()
self.initColors()
self.initGridLayout()
self.initClassifier()
self.initStandardLayout()
def __init__(self, *args, **kwargs):
"""Construct a new panel containing configuration widgets.
Args:
parent: Parent in wx hierarchy.
pg: Page to be configured.
*args, **kwargs: Additional arguments passed
to the wx.Panel base class.
"""
StandardConfigPanel.__init__(self, *args, **kwargs)
self.initRobot()
self.initNTrial()
self.initIntervals()
self.initSegWindow()
self.initClassifierKind()
self.initStandardLayout()
def __init__(self, parent, src, orient=wx.HORIZONTAL, *args, **kwargs):
"""Initialize a new source configuration panel.
Args:
parent: wx parent of this panel.
src: Source to configure.
args, kwargs: Additional arguments to pass to the wx.Panel
base class constructor.
"""
wx.Panel.__init__(self, parent=parent, *args, **kwargs)
self.src = src
self.sizer = wx.BoxSizer(orient=orient)
self.SetSizer(self.sizer)
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 __init__(self, parent, size=wx.Size(128,128), dpi=None, **kwargs):
self.size = size
self.dragging_curview_is_active = False
wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, size, 0, **kwargs)
self.ztv_frame = self.GetTopLevelParent()
self.figure = Figure(None, dpi)
self.axes = self.figure.add_axes([0., 0., 1., 1.])
self.curview_rectangle = Rectangle((0, 0), 1, 1, color='orange', fill=False, zorder=100)
self.axes.add_patch(self.curview_rectangle)
self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
self.overview_zoom_factor = 1.
self._SetSize()
self.set_xy_limits()
self.axes_widget = AxesWidget(self.figure.gca())
self.axes_widget.connect_event('button_press_event', self.on_button_press)
self.axes_widget.connect_event('button_release_event', self.on_button_release)
self.axes_widget.connect_event('motion_notify_event', self.on_motion)
pub.subscribe(self.redraw_overview_image, 'redraw-image')
pub.subscribe(self.redraw_box, 'primary-xy-limits-changed')
def __init__(self, parent, size=wx.Size(128,128), dpi=None, **kwargs):
self.size = size
self.dragging_curview_is_active = False
wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, size, 0, **kwargs)
self.ztv_frame = self.GetTopLevelParent()
self.figure = Figure(None, dpi)
self.axes = self.figure.add_axes([0., 0., 1., 1.])
self.curview_rectangle = Rectangle((0, 0), 1, 1, color='orange', fill=False, zorder=100)
self.axes.add_patch(self.curview_rectangle)
self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
self.overview_zoom_factor = 1.
self._SetSize()
self.set_xy_limits()
self.axes_widget = AxesWidget(self.figure.gca())
self.axes_widget.connect_event('button_press_event', self.on_button_press)
self.axes_widget.connect_event('button_release_event', self.on_button_release)
self.axes_widget.connect_event('motion_notify_event', self.on_motion)
pub.subscribe(self.redraw_overview_image, 'redraw-image')
pub.subscribe(self.redraw_box, 'primary-xy-limits-changed')
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="Sum or Subtract Arrays")
title.SetToolTipNew("Sum or subtract array2 from array 1")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.input_filename = TextPanelObject(self, "Input File 1: ", "",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.input_filename1 = TextPanelObject(self, "Input File 2: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.input_filename1, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.addsub = RadioBoxNew(self, label="Add or Subtract:", choices=['Add','Subtract'], majorDimension=2, style=wx.RA_SPECIFY_COLS)
self.addsub.SetToolTipNew("Add or Subtract")
vbox.Add(self.addsub, 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 = StaticTextNew(self, label="Rotate Support Array")
title.SetToolTipNew("Rotate support (binary complex) arrays only. \nStrange results will ensue if used on data arrays.")
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: ", "data_rotated.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.rotationaxis = SpinnerObject(self,"Axis:",3,1,1,1,150,150)
self.rotationaxis.label.SetToolTipNew("Rotation axis.")
vbox.Add(self.rotationaxis, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.rotationangle = SpinnerObject(self,"Angle:",360,-360,1,0,150,150)
self.rotationangle.label.SetToolTipNew("Rotation angle in degrees.")
vbox.Add(self.rotationangle, 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="Create binary mask from Numpy array")
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: ", "mask.npy",150,'*.npy')
vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.max = SpinnerObject(self,"Maximum Value:",MAX_INT,MIN_INT,1.0,MAX_INT,150,150)
self.max.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.")
self.min = SpinnerObject(self,"Minimum Value:",MAX_INT,MIN_INT,1,50.0,150,150)
self.min.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.")
vbox.Add(self.max, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
vbox.Add(self.min, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )