def switchPanels(self):
active = self.active
self.panelStart.Hide()
self.panelDrinks.Hide()
self.panelUsers.Hide()
self.panelThanks.Hide()
self.panelSorry.Hide()
self.panelRFID.Hide()
if active == 0:
if settings.enableRFID:
self.rfid.start()
self.panelStart.Show()
elif active == 1:
if not settings.onlyOneDrink:
self.panelDrinks.l_amount.SetLabel("%02d" % 1)
self.panelDrinks.l_user.SetLabel(self.user.longname)
self.panelDrinks.Show()
elif active == 2:
self.panelUsers.Show()
elif active == 3:
self.panelThanks.label_1.SetLabel(self.user.longname + "\n" + "%02d x " % int(self.panelDrinks.GetAmount()) + self.drinkl.split('\n')[0])
self.panelThanks.label_1.Wrap(340)
try:
self.panelThanks.bitmap_2.SetBitmap(wx.Bitmap("./app/static/product_%s.png" % self.drinkl.split('\n')[0], wx.BITMAP_TYPE_ANY))
except:
logging.error("no picture for drink: " + self.drinkl.split('\n')[0])
self.panelThanks.Show()
self.delayExit()
elif active == 4:
self.panelSorry.label_1.SetLabel(self.user.longname)
self.panelSorry.Show()
else: #active == 5:
self.panelRFID.label_1.SetLabel(self.rfidid)
self.panelRFID.Show()
python类BITMAP_TYPE_ANY的实例源码
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.parent = parent
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/users.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
users = get_users()
self.names = list()
for user in users:
if user.isshown and not user.onlyrfid:
self.names.append(user.longname)
self.but_names = list()
self.position = 0
self.lines = 4
self.items = len(self.names)
for i in range(self.lines):
#480x320
self.but = wx.lib.platebtn.PlateButton(self, label=self.names[self.position+i] if self.position+i < len(self.names) else "", pos=(3, 3+i*80),
style=wx.BU_EXACTFIT | wx.lib.platebtn.PB_STYLE_SQUARE)
self.but.SetSize((365, 74))
self.but.SetBackgroundColour((255-(i*20 % 40), (160+(i*50 % 100)), 0))
#self.but.SetForegroundColour("#006699")
self.but.SetPressColor(wx.Colour(255,255,255,0))
self.but.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.but.Bind(wx.EVT_LEFT_DOWN, parent.onUser, id=self.but.Id)
self.but_names.append(self.but)
self.b_up = wx.Button(self, id=wx.ID_ANY, label=u"\u25B2", pos=(374, 0), size=(106, 106))
self.b_up.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.b_up.Bind(wx.EVT_LEFT_DOWN, self.on_up, id=self.b_up.Id)
self.b_down = wx.Button(self, id=wx.ID_ANY, label=u"\u25BC", pos=(374, 214), size=(106, 106))
self.b_down.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.b_down.Bind(wx.EVT_LEFT_DOWN, self.on_down, id=self.b_down.Id)
self.b_exit = wx.Button(self, id=wx.ID_ANY, label="X", pos=(374, 107), size=(106, 106))
self.b_exit.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id)
self.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 __init__(self):
grc_wxgui.top_block_gui.__init__(self, title="Top Block")
_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 2000000
##################################################
# Blocks
##################################################
self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
self.GetWin(),
baseband_freq=930000000,
dynamic_range=100,
ref_level=0,
ref_scale=2.0,
sample_rate=samp_rate,
fft_size=512,
fft_rate=15,
average=False,
avg_alpha=None,
title='Waterfall Plot',
)
self.Add(self.wxgui_waterfallsink2_0.win)
self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
self.GetWin(),
baseband_freq=930000000,
y_per_div=10,
y_divs=10,
ref_level=0,
ref_scale=2.0,
sample_rate=samp_rate,
fft_size=1024,
fft_rate=15,
average=False,
avg_alpha=None,
title='FFT Plot',
peak_hold=False,
)
self.Add(self.wxgui_fftsink2_0.win)
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/bill/signal_hunter/out.iq', True)
##################################################
# Connections
##################################################
self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
self.connect((self.blocks_throttle_0, 0), (self.wxgui_waterfallsink2_0, 0))
def __init__(self, *args, **kwds):
# begin wxGlade: student_profie.__init__
kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLIP_CHILDREN
wx.Frame.__init__(self, *args, **kwds)
self.panel_1 = wx.Panel(self, wx.ID_ANY, style=wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
self.combo_box_13 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
self.combo_box_14 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
self.combo_box_15 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
self.button_1 = wx.Button(self.panel_1, wx.ID_ANY, _("Add New"))
self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_CENTRE)
self.bitmap_button_2 = wx.BitmapButton(self.panel_1, wx.ID_ANY, wx.Bitmap("/media/ghssvythiri/10C63D64C63D4AEC/asif/sqlite_working_aug_16/Resources/img/pass.jpg", wx.BITMAP_TYPE_ANY), style=wx.BU_AUTODRAW)
self.static_line_1 = wx.StaticLine(self.panel_1, wx.ID_ANY)
self.bitmap_button_1 = wx.BitmapButton(self.panel_1, wx.ID_ANY, wx.Bitmap("/media/ghssvythiri/10C63D64C63D4AEC/asif/sqlite_working_aug_16/Resources/img/exit.jpg", wx.BITMAP_TYPE_ANY))
self.label_1 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Name"))
self.label_2 = wx.StaticText(self.panel_1, wx.ID_ANY, _("UID"))
self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Gender"))
self.text_ctrl_2 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_3 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.combo_box_16 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Date of Birth"))
self.label_5 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Category"))
self.label_6 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Reigion"))
self.text_ctrl_4 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_5 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_6 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.label_7 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Caste"))
self.label_8 = wx.StaticText(self.panel_1, wx.ID_ANY, _("First Language"))
self.label_9 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Father"))
self.text_ctrl_7 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_8 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_9 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.label_10 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Mother"))
self.label_11 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Mobile"))
self.label_12 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Email"))
self.text_ctrl_10 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_11 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_12 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.hyperlink_1 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "")
self.hyperlink_2 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "")
self.hyperlink_3 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "")
self.static_line_2 = wx.StaticLine(self.panel_1, wx.ID_ANY)
self.button_3 = wx.Button(self.panel_1, wx.ID_ANY, _("Delete"))
self.button_2 = wx.Button(self.panel_1, wx.ID_ANY, _("Close"))
self.button_4 = wx.Button(self.panel_1, wx.ID_ANY, _("Save"))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.on_search, self.bitmap_button_2)
# end wxGlade
def on_save(self, event): # wxGlade: student_profie.<event_handler>
if self.button_save.Label=="Edit":
self.on_edit()
self.button_delete.Disable()
else:
# if button save
if self.text_ctrl_name.Value and self.combo_box_adno.GetValue():
if not self.validate_all():
event.Skip()
return 0
if self.add_flag:
result=self.db_insert()
else:
result=self.db_update()
if result:
if self.prof_pic_path!='':
from shutil import copyfile
cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
dest=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"
copyfile(self.prof_pic_path,dest)
self.load_admission_no()
self.button_save.Disable()
else:
msg= "Admission number and name mandatory"
dlg = wx.MessageDialog(self, msg, '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
self.button_save.Label="Edit"
self.set_editable(False)
self.bitmap_photo.Enable(False)
cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
path=cur_dir+"/Resources/img/browse.jpg"
self.bitmap_photo = wx.BitmapButton(self.panel_1, wx.ID_ANY,wx.Bitmap(path, wx.BITMAP_TYPE_ANY))
self.__set_properties()
self.__do_layout()
event.Skip()