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()
python类StaticBitmap()的实例源码
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):
"""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
def layout(self):
"""
Layout the widgets on the panel
"""
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
img = wx.EmptyImage(self.photoMaxSize,self.photoMaxSize)
self.imageCtrl = wx.StaticBitmap(self, wx.ID_ANY,
wx.BitmapFromImage(img))
self.mainSizer.Add(self.imageCtrl, 0, wx.ALL|wx.CENTER, 5)
self.imageLabel = wx.StaticText(self, label="")
self.mainSizer.Add(self.imageLabel, 0, wx.ALL|wx.CENTER, 5)
btnData = [("Previous", btnSizer, self.onPrevious),
("Slide Show", btnSizer, self.onSlideShow),
("Next", btnSizer, self.onNext)]
for data in btnData:
label, sizer, handler = data
self.btnBuilder(label, sizer, handler)
self.mainSizer.Add(btnSizer, 0, wx.CENTER)
self.SetSizer(self.mainSizer)
def convert(self):
self.Bind(wx.EVT_TIMER, self.OnTimer2, self.timer2)
self.dltext.SetLabel(self.query)
self.panel.Layout()
imageFile = 'Files\image.jpg'
data = open(imageFile, "rb").read()
# convert to a data stream
stream = cStringIO.StringIO(data)
# convert to a bitmap
bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
# show the bitmap, (5, 5) are upper left corner coordinates
thumb = wx.StaticBitmap(self, -1, bmp, (90,255))
self.Hide()
self.Show()
self.text.SetLabel('Converting...')
if self.rb1.GetValue() == True:
self.timer2.Start(1000)
worker1 = threading.Thread(target=lambda: self.getfile.get_file('http://www.youtube.com/%s'%self.vidurl, '320'))
worker1.start()
elif self.rb2.GetValue() == True:
self.timer2.Start(600)
worker1 = threading.Thread(target=lambda: self.getfile.get_file('http://www.youtube.com/%s'%self.vidurl, '128'))
worker1.start()
def InitUI(self):
sb = wx.StaticText(self, label='Stop! Open or Create new project first!')
ic = wx.ArtProvider.GetBitmap( wx.ART_TIP, size=(48,48) )
icn= wx.StaticBitmap(self,-1,ic,name='Stop')
lbl_mt = wx.StaticText(self, label="")
vbox = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(vbox)
vbox.Add(lbl_mt,flag=wx.CENTER, border=2)
vbox.Add(sb,flag=wx.CENTER, border=2)
vbox.Add(icn,flag=wx.CENTER, border=0)
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
OButton = wx.Button(self, label='Open')
NButton = wx.Button(self, label='New')
hbox2.Add(OButton, flag=wx.CENTER, border=2)
hbox2.Add(NButton, flag=wx.LEFT, border=5)
vbox.Add(hbox2,flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=2)
OButton.Bind(wx.EVT_BUTTON,self.OpenBtn)
NButton.Bind(wx.EVT_BUTTON,self.NewBtn)
self.Show()
self.SetFocus()
self.SetWindowStyle( wx.STAY_ON_TOP )
def BuildTimeline(self,dbfile):
for child in self.panel3.GetChildren():
logging.exception(child)
child.Destroy()
# the last frame is
latestfram = self.cur.execute("SELECT * FROM Timeline ORDER BY Image DESC LIMIT 1")
#latestfram = self.cur.execute("SELECT * FROM Timeline WHERE ID = (SELECT MAX(ID) FROM TABLE) AND Blackspot = 0");
try:
for entry in latestfram:
self.framlog = int(entry[1].split('.')[0])
self.framlog += 1
logging.exception(self.framlog)
except:
logging.exception('Looking for last frame but did not find.')
pass
# timeline contains
tbl_timeline = self.cur.execute("SELECT * FROM Timeline WHERE Blackspot=0")
for entry in tbl_timeline:
img = self.MakeThumbnail(os.path.join(self.imgdir, entry[1]), self.thumbsize)
self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY,
wx.BitmapFromImage(img),name=entry[1])
self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )
logging.exception(self.imageCtrl.GetId() )
self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )
self.Layout()
self.panel3.SetFocus()
self.BindKeys(dbfile)
self.hbox2.Layout()
self.panel3.Refresh()
self.panel3.Update()
self.Refresh()
def OnLeftRelease(self,e):
self.player.stop()
self.brec.SetBitmapLabel(self.brecxicon)
self.bplay.SetBitmapLabel(self.bplayicon)
if self.hasSelected:
#the frame selected was clicked
img = self.MakeThumbnail(os.path.join(self.imgdir, self.selected.GetName() ), self.thumbsize)
self.selected.SetBitmap(wx.BitmapFromImage(img) )
self.hasSelected = True
self.previous = 0
self.player.play()
self.viewport.Refresh()
self.brec.SetBitmapLabel(self.brecicon)
if not self.hasSelected:
# we clicked something new
# get new selection
self.selected = e.GetEventObject()
# highlight new selection
img = self.MakeThumbnail(os.path.join(self.imgdir, self.selected.GetName() ), self.thumbsize + 3)
imgb = wx.BitmapFromImage(img)
dc = wx.MemoryDC(imgb)
staricon = wx.Image(os.path.join(os.path.dirname(__file__),'..','..','stopgo','images','select.png') )
star = wx.BitmapFromImage(staricon)
dc.DrawBitmap(star,133,0)
dc.SelectObject(wx.NullBitmap)
del dc
control = wx.StaticBitmap(self, -1, imgb)
self.selected.SetBitmap(imgb)
self.hasSelected = True
self.previous = self.selected.GetId()
#paint canvas
img = self.MakeThumbnail(os.path.join( self.imgdir, self.selected.GetName() ), self.screenHeight*.9)
self.GetStatusBar().SetStatusText(self.selected.GetName(), 0)
self.PaintCanvas(img)
self.viewport.Refresh()
def PaintCanvas(self,img):
bmp = wx.BitmapFromImage( img )
canvas = wx.StaticBitmap( self.viewport, bitmap=bmp, pos=(0,0) )
def TakeSnapshot(self,e,args):
logging.exception('CAPTURE')
if self.camset == 1:
self.framlog += 1
#print(self.camhero)#DEBUG
vidcap = vlc.libvlc_video_take_snapshot(self.player,0,os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'),0,0)
self.cur.execute('INSERT INTO Timeline VALUES(Null,?,?)', (str(self.framlog).zfill(3)+'.png',0))
# add graphically to timeline
img = self.MakeThumbnail(os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'), self.thumbsize)
self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, wx.BitmapFromImage(img),name=str(self.framlog).zfill(3)+'.png')
self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )
logging.exception(self.imageCtrl.GetId() )
self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )
# scroll right 100% to get close to new frame
self.panel3.Scroll(self.thumbsize,0)
self.Layout()
# draw new frame
self.hbox2.Layout()
self.panel3.Refresh()
# scroll WAY right again to show frame
self.panel3.Scroll(200,0)
# send the shot to onion skin
img = os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png')
self.OnionSkin(img)
logging.exception(self.framlog)
else:
dlg = wx.MessageDialog(self, 'Please select your camera first.','',wx.OK | wx.ICON_ERROR)
val = dlg.ShowModal()
if val == wx.ID_OK:
dlg.Destroy()
if val == wx.ID_CANCEL:
dlg.Destroy()
self.player.play()
self.brec.SetBitmapLabel(self.brecicon)
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('./sysconf.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
#SDcard details
system_info_pnl.sys_hdd_total = wx.StaticText(self, label='total;', pos=(250, 180), size=(200,30))
system_info_pnl.sys_hdd_remain = wx.StaticText(self, label='free;', pos=(250, 250), size=(200,30))
system_info_pnl.sys_hdd_used = wx.StaticText(self, label='Used;', pos=(250, 215), size=(200,30))
system_info_pnl.sys_pigrow_folder = wx.StaticText(self, label='Pigrow folder;', pos=(250, 285), size=(200,30))
#Software details
system_info_pnl.sys_os_name = wx.StaticText(self, label='os installed;', pos=(250, 365), size=(200,30))
#system_info_pnl.sys_pigrow_version = wx.StaticText(self, label='pigrow version;', pos=(250, 405), size=(200,30))
system_info_pnl.sys_pigrow_update = wx.StaticText(self, label='Pigrow update status', pos=(250, 450), size=(200,30))
#wifi deatils
system_info_pnl.sys_network_name = wx.StaticText(self, label='network name', pos=(250, 535), size=(200,30))
system_info_pnl.wifi_list = wx.StaticText(self, label='wifi list', pos=(140, 620), size=(200,30))
#camera details
system_info_pnl.sys_camera_info = wx.StaticText(self, label='camera info', pos=(585, 170), size=(200,30))
#power level warning details
system_info_pnl.sys_power_status = wx.StaticText(self, label='power status', pos=(625, 390), size=(200,30))
# Raspberry Pi revision
system_info_pnl.sys_pi_revision = wx.StaticText(self, label='raspberry pi version', pos=(625, 450), size=(200,30))
# Pi datetime vs local pc datetime
system_info_pnl.sys_pi_date = wx.StaticText(self, label='datetime on pi', pos=(625, 495), size=(500,30))
system_info_pnl.sys_pc_date = wx.StaticText(self, label='datetime on local pc', pos=(625, 525), size=(200,30))
#system_info_pnl.sys_time_diff = wx.StaticText(self, label='difference', pos=(700, 555), size=(200,30))
#
#
#
### pigrow Config pannel
#
#
def InitUI(self):
# these need to be set by whoever calls the dialog box before it's created
device = config_ctrl_pnl.device_toedit
gpio = config_ctrl_pnl.gpio_toedit
wiring = config_ctrl_pnl.wiring_toedit
# draw the pannel
pnl = wx.Panel(self)
wx.StaticText(self, label='Device GPIO Config', pos=(20, 10))
#background image
png = wx.Image('./relaydialogue.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
# devices combo box
switch_list = self.list_switch_scripts()
unlinked_devices = self.list_unused_devices(switch_list)
wx.StaticText(self, label='Device;', pos=(20, 50))
self.devices_combo = wx.ComboBox(self, choices = unlinked_devices, pos=(90,50), size=(175, 25))
self.devices_combo.SetValue(device)
# gpio text box
wx.StaticText(self, label='GPIO', pos=(10, 100))
self.gpio_tc = wx.TextCtrl(self, pos=(56, 98), size=(40, 25))
self.gpio_tc.SetValue(gpio)
self.gpio_tc.Bind(wx.EVT_CHAR, self.onChar) #limit to valid gpio numbers
# wiring direction combo box
wiring_choices = ['low', 'high']
wx.StaticText(self, label='Wiring side;', pos=(100, 100))
self.wiring_combo = wx.ComboBox(self, choices = wiring_choices, pos=(200,98), size=(110, 25))
self.wiring_combo.SetValue(wiring)
#Buttom Row of Buttons
okButton = wx.Button(self, label='Ok', pos=(200, 250))
closeButton = wx.Button(self, label='Cancel', pos=(300, 250))
okButton.Bind(wx.EVT_BUTTON, self.set_new_gpio_link)
closeButton.Bind(wx.EVT_BUTTON, self.OnClose)
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 )
#set blank variables
localfiles_info_pnl.local_path = ""
## Draw UI elements
png = wx.Image('./localfiles.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
# placing the information boxes
localfiles_info_pnl.local_path_txt = wx.StaticText(self, label='local path', pos=(220, 80), size=(200,30))
#local photo storage info
localfiles_info_pnl.caps_folder = 'caps'
localfiles_info_pnl.folder_text = wx.StaticText(self, label=' ' + localfiles_info_pnl.caps_folder, pos=(720, 130), size=(200,30))
localfiles_info_pnl.photo_text = wx.StaticText(self, label='photo text', pos=(575, 166), size=(170,30))
localfiles_info_pnl.first_photo_title = wx.StaticText(self, label='first image', pos=(575, 290), size=(170,30))
localfiles_info_pnl.last_photo_title = wx.StaticText(self, label='last image', pos=(575, 540), size=(170,30))
#file list boxes
localfiles_info_pnl.config_files = self.config_file_list(self, 1, pos=(5, 160), size=(550, 200))
localfiles_info_pnl.config_files.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_config)
localfiles_info_pnl.logs_files = self.logs_file_list(self, 1, pos=(5, 390), size=(550, 200))
localfiles_info_pnl.logs_files.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_logs)
#localfiles_info_pnl.config_files = self.config_file_list(self, 1, pos=(5, 160), size=(550, 200))
# localfiles_info_pnl.config_files.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_config)
#cron info text
localfiles_info_pnl.cron_info = wx.StaticText(self, label='cron info', pos=(290, 635), size=(200,30))
def draw_photo_folder_images(self, first_pic, last_pic):
# load and display first image
first = wx.Image(first_pic, wx.BITMAP_TYPE_ANY)
first = first.Scale(225, 225, wx.IMAGE_QUALITY_HIGH)
first = first.ConvertToBitmap()
localfiles_info_pnl.photo_folder_first_pic = wx.StaticBitmap(self, -1, first, (620, 310), (first.GetWidth(), first.GetHeight()))
# load and display last image
last = wx.Image(last_pic, wx.BITMAP_TYPE_ANY)
last = last.Scale(225, 225, wx.IMAGE_QUALITY_HIGH)
last = last.ConvertToBitmap()
localfiles_info_pnl.photo_folder_last_pic = wx.StaticBitmap(self, -1, last, (620, 565), (last.GetWidth(), last.GetHeight()))
def __init__(self, parent):
self.panel = wx.ScrolledWindow.__init__(self, parent)
self.SetScrollRate(5, 5)
self.panelphase = self.GetParent().panelphase
self.panelvisual = self.GetParent().panelvisual
self.cmvbox = wx.BoxSizer(wx.VERTICAL)
self.cmhbox = []
self.imglist = []
self.sellist = []
self.rb = []
self.chkb = []
array = self.panelphase.cms[0][1]
dc = wx.ScreenDC()
dc.SetFont(self.panelvisual.font)
w,h = dc.GetTextExtent("TestString")
height = h
if IsNotWX4():
image = wx.EmptyImage(array.shape[0],height)
else:
image = wx.Image(array.shape[0],height)
newarray = numpy.zeros((height, array.shape[0], 3), dtype=numpy.uint8)
for i in range(self.panelphase.cms.shape[0]):
self.cmhbox.append( wx.BoxSizer(wx.HORIZONTAL) )
name = self.panelphase.cms[i][0]
array = self.panelphase.cms[i][1]
for j in range(height):
newarray[j,:,:] = numpy.uint8(255.0*array)
image.SetData( newarray.tostring())
bmp = image.ConvertToBitmap()
self.imglist.append(wx.StaticBitmap(self, -1, bmp))
self.rb.append( wx.RadioButton(self, -1, label=name, size=(160, height) ) )
self.cmhbox[-1].Add(self.rb[-1], 0)
self.cmhbox[-1].Add((5, -1))
self.cmhbox[-1].Add(self.imglist[-1], 1, wx.EXPAND)
self.chkb.append( wx.CheckBox(self, -1, 'Reverse', size=(160, height)) )
self.cmhbox[-1].Add(self.chkb[-1], 0, wx.EXPAND)
self.cmvbox.Add(self.cmhbox[-1], 1, wx.EXPAND)
self.SetSizer(self.cmvbox)
self.Fit()
self.Layout()
self.Show()
def display_matches(self):
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.images = []
self.labels = []
m = self.session.matches()
for i in range(len(m)):
match = m[i]
# Thumb
fd = urlopen(match.user.thumbnails[0])
file = io.BytesIO(fd.read())
img = wx.Image(file, wx.BITMAP_TYPE_ANY)
self.images.append(wx.StaticBitmap(self.panel, wx.ID_ANY,
wx.Bitmap(img)))
self.images[i].Bind(wx.EVT_BUTTON, self.onClick)
# Label for name
self.labels.append(wx.StaticText(self.panel, label=match.user.name))
# Add to sizer
self.mainSizer.Add(self.labels[i], 0, wx.ALL, 5)
self.mainSizer.Add(self.images[i], 0, wx.ALL, 5)
self.mainSizer.Add(self.sizer, 0, wx.ALL, 5)
self.panel.SetSizer(self.mainSizer)
self.panel.Layout()
self.panel.Refresh()
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,id,title,size=(475,600))
self.parent = parent
self.initialize()
# Exit
exit_button = wx.Button(self, label="Exit", pos=(240+75,550))
exit_button.Bind(wx.EVT_BUTTON, self.onClose)
# robot = "/home/pi/Desktop/GoBox/Troubleshooting_GUI/dex.png"
# png = wx.Image(robot, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
# wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth()-320, png.GetHeight()-20))
# self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) # Sets background picture
#----------------------------------------------------------------------
def __init__(self, parent, ID, bitmapname,
pos=wx.DefaultPosition, size=wx.DefaultSize,
style=0,
name="genstatbmp"):
bitmap = GetBitmap(bitmapname)
if bitmap is None:
bitmap = wx.EmptyBitmap(0, 0)
wx.StaticBitmap.__init__(self, parent, ID,
bitmap,
pos, size,
style,
name)
def __init__(self, *args, **kwds):
# begin wxGlade: sampoorna_win.__init__
kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.STAY_ON_TOP | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLIP_CHILDREN
wx.Frame.__init__(self, *args, **kwds)
self.panel_1 = wx.ScrolledWindow(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
self.panel_warning = wx.Panel(self.panel_1, wx.ID_ANY, style=wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL)
self.label_1 = wx.StaticText(self.panel_warning, wx.ID_ANY, _("label_1"))
self.panel_login = wx.Panel(self.panel_1, wx.ID_ANY)
self.bitmap_1 = wx.StaticBitmap(self.panel_login, wx.ID_ANY, wx.Bitmap("/home/ghssvythiri/Desktop/about.jpeg", wx.BITMAP_TYPE_ANY))
self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_2"))
self.text_ctrl_1 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "")
self.label_3 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_3"))
self.text_ctrl_2 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "", style=wx.TE_PASSWORD)
self.button_1 = wx.Button(self.panel_login, wx.ID_ANY, _("button_1"))
self.panel_class = wx.Panel(self.panel_1, wx.ID_ANY)
self.checkbox_1 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_1"))
self.checkbox_2 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_2"))
self.checkbox_3 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_3"))
self.button_2 = wx.Button(self.panel_class, wx.ID_ANY, _("button_2"))
self.panel_progress = wx.Panel(self.panel_1, wx.ID_ANY)
self.panel_report = wx.Panel(self.panel_1, wx.ID_ANY)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.on_next, self.button_2)
# end wxGlade
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("/home/john/Pictures/jasper gui jarvis/jarvisrotator.png", wx.BITMAP_TYPE_ANY))
self.__set_properties()
self.__do_layout()
# end wxGlade
def __init__(self, parent):
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/start.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
if not settings.hideGuiList:
self.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
def __init__(self, parent):
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/thanks.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
self.bitmap_2 = wx.StaticBitmap(self, wx.ID_ANY, wx.NullBitmap, pos=(10, 10))
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(120, 50), size=(340, 100))
self.label_1.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.label_1.SetForegroundColour("white")
def __init__(self, parent):
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/sorry.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
def __init__(self, parent):
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/rfid.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100), size=(100,220))
self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
def __init__(self, parent):
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/products.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
products = get_products()
buttonids = []
i = 0
for product in products:
if product.isshown:
#480x320
self.but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + u"%0.2f" % product.price, pos=((i%4)*120, int(i/4)*120), size=(120, 120))
self.but.SetBackgroundColour((255-((i+int(i/4))*20 % 40), (160+((i+int(i/4))*50 % 100)), 0))
#self.but.SetForegroundColour("#006699")
self.but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.but.Bind(wx.EVT_LEFT_DOWN, parent.onProduct, id=self.but.Id)
i += 1
if not settings.onlyOneDrink:
self.b_less = wx.Button(self, id = wx.ID_ANY, label=u"-", pos=(0,250), size=(120, 70))
self.b_less.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.b_less.Bind(wx.EVT_LEFT_DOWN, self.onLess, id=self.b_less.Id)
self.l_amount = wx.StaticText(self, wx.ID_ANY, "%2d" % 0, pos=(137, 245), style=wx.ALIGN_CENTER)
self.l_amount.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
self.b_more = wx.Button(self, id = wx.ID_ANY, label=u"+", pos=(240,250), size=(120, 70))
self.b_more.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.b_more.Bind(wx.EVT_LEFT_DOWN, self.onMore, id=self.b_more.Id)
self.b_exit = wx.Button(self, id = wx.ID_ANY, label=u"x", pos=(360,250), size=(120, 70))
self.b_exit.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id)
if i <= 4:
self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=(20,170), style=wx.ALIGN_CENTER)
else:
self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=((i%4)*120+20,170), style=wx.ALIGN_CENTER)
self.l_user.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
def _create_item(self, channel, icon, multiple):
item_sizer = wx.BoxSizer(wx.VERTICAL)
module_sizer = wx.FlexGridSizer(0, 0, 5, 3)
bitmap = wx.StaticBitmap(self, wx.ID_ANY,
wx.Bitmap(icon),
size=wx.Size(16, 16))
module_sizer.Add(bitmap, 0, wx.EXPAND)
channel_name = '{}: '.format(channel) if multiple else ''
channel_text = wx.StaticText(self, id=wx.ID_ANY, label=channel_name)
module_sizer.Add(channel_text, 0, wx.EXPAND)
label = wx.StaticText(self, id=wx.ID_ANY, label='N/A')
module_sizer.Add(label, 1, wx.EXPAND)
module_sizer.AddSpacer(2)
item_sizer.Add(module_sizer, 0, wx.EXPAND)
status_sizer = wx.BoxSizer(wx.HORIZONTAL)
status_item = wx.Panel(self, size=wx.Size(-1, 5))
status_item.SetBackgroundColour('gray')
status_sizer.Add(status_item, 1, wx.EXPAND)
item_sizer.AddSpacer(3)
item_sizer.Add(status_sizer, 1, wx.EXPAND)
item_sizer.AddSpacer(2)
self.border_sizer.Add(item_sizer, 0, wx.EXPAND)
return {'item': item_sizer, 'label': label,
'status': status_item, 'name': channel_text, 'channel': channel}
def __init__(self, parent, bitmap=wx.NullBitmap, size=util.MAX_IMAGE_SIZE):
super(MyStaticBitmap, self).__init__(parent)
self.bmp = bitmap
self.scale = 1.0
self.bitmap = wx.StaticBitmap(self, bitmap=bitmap)
self.size = size
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.AddStretchSpacer()
self.sizer.Add(self.bitmap, 0, wx.EXPAND)
self.sizer.AddStretchSpacer()
self.SetMinSize((size, size))
self.SetSizer(self.sizer)
self.sizer.Layout()
def __init__(self, parent, id):
# create the panel
wx.Panel.__init__(self, parent, id)
try:
# pick an image file you have in the working
# folder you can load .jpg .png .bmp or
# .gif files
image_file = 'big_cat.jpg'
bmp1 = wx.Image(
image_file,
wx.BITMAP_TYPE_ANY).ConvertToBitmap()
# image's upper left corner anchors at panel
# coordinates (0, 0)
self.bitmap1 = wx.StaticBitmap(
self, -1, bmp1, (0, 0))
# show some image details
str1 = "%s %dx%d" % (image_file, bmp1.GetWidth(),
bmp1.GetHeight())
parent.SetTitle(str1)
except IOError:
print("Image file %s not found" % imageFile)
raise SystemExit
# button goes on the image --> self.bitmap1 is the
# parent
self.button1 = wx.Button(
self.bitmap1, label='Button1',
pos=(8, 8))
def createWidgets(self):
instructions = 'Browse for an image'
img = wx.Image(240,240)
self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY,
wx.Bitmap(img))
instructLbl = wx.StaticText(self.panel, label=instructions)
self.photoTxt = wx.TextCtrl(self.panel, size=(200,-1))
browseBtn = wx.Button(self.panel, label='Browse')
browseBtn.Bind(wx.EVT_BUTTON, self.onBrowse)
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.mainSizer.Add(wx.StaticLine(self.panel, wx.ID_ANY),
0, wx.ALL|wx.EXPAND, 5)
self.mainSizer.Add(instructLbl, 0, wx.ALL, 5)
self.mainSizer.Add(self.imageCtrl, 0, wx.ALL, 5)
self.sizer.Add(self.photoTxt, 0, wx.ALL, 5)
self.sizer.Add(browseBtn, 0, wx.ALL, 5)
self.mainSizer.Add(self.sizer, 0, wx.ALL, 5)
self.panel.SetSizer(self.mainSizer)
self.mainSizer.Fit(self.frame)
self.panel.Layout()
def create_main_panel(self):
# Panels
self.img_panel = wx.Panel(self)
self.joy_panel = wx.Panel(self)
self.record_panel = wx.Panel(self)
# Images
img = wx.Image(320,240)
self.image_widget = wx.StaticBitmap(self.img_panel, wx.ID_ANY, wx.Bitmap(img))
# Joystick
self.init_plot()
self.PlotCanvas = FigCanvas(self.joy_panel, wx.ID_ANY, self.fig)
# Recording
self.txt_outputDir = wx.TextCtrl(self.record_panel, wx.ID_ANY, pos=(5,0), size=(320,30))
uid = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
self.txt_outputDir.ChangeValue("samples/" + uid)
self.btn_record = wx.Button(self.record_panel, wx.ID_ANY, label="Record", pos=(335,0), size=(100,30))
self.Bind(wx.EVT_BUTTON, self.on_btn_record, self.btn_record)
self.Bind(wx.EVT_UPDATE_UI, self.on_update_btn_record, self.btn_record)
# sizers
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.img_panel, 0, wx.ALL, 5)
sizer.Add(self.joy_panel, 0, wx.ALL, 5)
mainSizer_v = wx.BoxSizer(wx.VERTICAL)
mainSizer_v.Add(sizer, 0 , wx.ALL, 5)
mainSizer_v.Add(self.record_panel, 0 , wx.ALL, 5)
# finalize layout
self.SetAutoLayout(True)
self.SetSizer(mainSizer_v)
self.Layout()