def __init__(self):
'''
@summary: Constructor
@param config_dict: The build configuration, if present
@param load_config: Handle to a config loader method/object
'''
self.language = DEFAULT_LANGUAGE
self.__builder = None
self.config_file_path = None
# Init super - MainFrame
MainFrame.__init__( self, parent=None )
self.console = Console(self.ConsoleTextCtrl)
self.StatusBar.SetStatusText("Ready...")
self.SetIcon(wx.IconFromBitmap(wx.Bitmap("ExeBuilder\\static\\builder_logo.bmp", wx.BITMAP_TYPE_ANY)))
# Update GUI Visuals
self.update_gui_visuals()
# Set initial event handlers
self.set_events()
python类BITMAP_TYPE_ANY的实例源码
def graph_caps(self, cap_files, graphdir):
OS = "linux"
if len(cap_files) > 1:
print("make caps graph")
if OS == "linux":
print("Yay linux")
os.system("../visualisation/caps_graph.py caps="+capsdir+" out="+graphdir)
elif OS == 'win':
print("oh, windows, i prefer linux but no worries...")
os.system("python ../visualisation/caps_graph.py caps="+capsdir+" out="+graphdir)
else:
print("skipping graphing caps - disabled or no caps to make graphs with")
if os.path.exists(graphdir+'caps_filesize_graph.png'):
cap_size_graph_path = wx.Image(graphdir+'caps_filesize_graph.png', wx.BITMAP_TYPE_ANY)
return cap_size_graph_path
else:
print("NOT ENOUGH CAPS GRAPH SO USING BLANK THUMB")
blankimg = wx.EmptyImage(width=100, height=100, clear=True)
return blankimg
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 view(self, file):
'''
Called when loading a new image. Pass arg bytesIO image file
'''
img = wx.Image(file, wx.BITMAP_TYPE_ANY)
# scale the image, preserving the aspect ratio
W = img.GetWidth()
H = img.GetHeight()
if W > H:
NewW = self.PhotoMaxSize
NewH = self.PhotoMaxSize * H / W
else:
NewH = self.PhotoMaxSize
NewW = self.PhotoMaxSize * W / H
img = img.Scale(NewW, NewH)
self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
self.panel.Refresh()
def __init__(self, parent=None, fdir='./', title='pyDataViewer',
size=(800,600), **kwargs):
wx.Frame.__init__(self,parent,title=title,size=size)
try:
_icon = wx.EmptyIcon()
_icon.CopyFromBitmap(
# postproclib.visualiser.__path__ (pplvpath) is a list
wx.Bitmap(pplvpath[0]+"/logo.gif", wx.BITMAP_TYPE_ANY)
)
self.SetIcon(_icon)
except IOError:
print('Couldn\'t load icon')
self.dirchooser = DirectoryChooserPanel(self, fdir)
self.vbox = wx.BoxSizer(wx.VERTICAL)
self.vbox.Add(self.dirchooser, 0, wx.EXPAND, 0)
self.SetSizer(self.vbox)
self.visualiserpanel = None
self.new_visualiserpanel(fdir)
self.fdir = fdir
self.set_bindings()
def __set_properties(self):
# begin wxGlade: Login.__set_properties
self.SetTitle("Login")
#_icon = wx.EmptyIcon()
#_icon.CopyFromBitmap(wx.Bitmap("/media/f67bc164-f440-4c0f-9e9b-3ad70ff1adc2/home/asif/Desktop/waiter animation/2.gif", wx.BITMAP_TYPE_ANY))
#self.SetIcon(_icon)
self.SetSize((462, 239))
self.SetFocus()
self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
self.combo_box_1.SetSelection(0)
self.label_2.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
self.text_ctrl_1.SetMinSize((185, 30))
self.button_1.SetMinSize((85, 35))
self.button_1.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Ubuntu"))
self.button_2.SetMinSize((85, 35))
self.button_2.Disable()
# end wxGlade
def on_delete(self, event): # wxGlade: student_profie.<event_handler>
self.button_delete.Disable()
self.button_save.Disable()
self.db_delete()
self.clear_student_details()
self.bitmap_photo.Enable(False)
cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
path=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"
if os.path.isfile(path):
path=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"
os.remove(path)
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()
def onView(self):
"""
Attempts to load the image and display it
"""
filepath = self.photoTxt.GetValue()
img = wx.Image(filepath, wx.BITMAP_TYPE_ANY)
# scale the image, preserving the aspect ratio
W = img.GetWidth()
H = img.GetHeight()
if W > H:
NewW = self.PhotoMaxSize
NewH = self.PhotoMaxSize * H / W
else:
NewH = self.PhotoMaxSize
NewW = self.PhotoMaxSize * W / H
img = img.Scale(NewW,NewH)
self.imageCtrl.SetBitmap(wx.Bitmap(img))
self.panel.Refresh()
self.mainSizer.Fit(self.frame)
def loadImage(self, image):
"""
Load the image into the application for display
"""
image_name = os.path.basename(image)
img = wx.Image(image, wx.BITMAP_TYPE_ANY)
# scale the image, preserving the aspect ratio
W = img.GetWidth()
H = img.GetHeight()
if W > H:
NewW = self.photoMaxSize
NewH = self.photoMaxSize * H / W
else:
NewH = self.photoMaxSize
NewW = self.photoMaxSize * W / H
img = img.Scale(NewW,NewH)
self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
self.imageLabel.SetLabel(image_name)
self.Refresh()
Publisher().sendMessage("resize", "")
def MakeThumbnail(self, filepath, PhotoMaxSize):
img = wx.Image(filepath, wx.BITMAP_TYPE_ANY)
# scale image, preserve aspect ratio
W = img.GetWidth()
H = img.GetHeight()
if W > H:
NewW = PhotoMaxSize
NewH = PhotoMaxSize * H / W
else:
NewH = PhotoMaxSize
NewW = PhotoMaxSize * W / H
img = img.Scale(NewW,NewH)
imgb = wx.BitmapFromImage(img)
return img
def load_zad(self, file_path, fit=True):
img = wx.Image(file_path, wx.BITMAP_TYPE_ANY)
if fit:
w, h = img.GetWidth(), img.GetHeight()
max_w, max_h = self.images_panel.GetSize()
target_ratio = min(max_w / float(w), max_h / float(h))
new_w, new_h = [int(x * target_ratio) for x in (w, h)]
img = img.Scale(new_w, new_h, wx.IMAGE_QUALITY_HIGH)
self.images_panel.drawable_bitmap = wx.Bitmap(img)
self.images_panel.Refresh()
def CreateBitmap(self, artid, client, size):
if not artid.startswith('priv'):
return wx.NullBitmap
artid = artid.split('/')[1:] # Split path and remove 'priv'
artid = '/'.join(artid) # rejoin remaining parts
fpath = appconstants.getdatapath(artid)
return wx.Bitmap(fpath, wx.BITMAP_TYPE_ANY)
def __init__(self, parent, title):
style = wx.DEFAULT_FRAME_STYLE & ~(
wx.RESIZE_BORDER | wx.MAXIMIZE_BOX |
wx.MINIMIZE_BOX|wx.CLOSE_BOX)
wx.Frame.__init__(self, parent, title=title,
style=style, size=(400,60))
self.textbox = wx.TextCtrl(self)
img = wx.Image("matags.png", wx.BITMAP_TYPE_ANY)
bmp = wx.Bitmap(img)
self.icon = wx.Icon()
self.icon.CopyFromBitmap(bmp)
self.SetIcon(self.icon)
self.tbIcon = wx.adv.TaskBarIcon()
self.tbIcon.SetIcon(self.icon)
self.Show(True)
self.Centre()
self.reg_hot_keys()
self.Bind(wx.EVT_HOTKEY, self.on_extract_tag,
id=self.hotkeys['extract_tag'][0])
self.Bind(wx.EVT_HOTKEY, self.on_close,
id=self.hotkeys['quit'][0])
self.Bind(wx.EVT_HOTKEY, self.on_activate,
id=self.hotkeys['activate'][0])
self.Bind(wx.EVT_HOTKEY, self.on_refresh,
id=self.hotkeys['refresh'][0])
self.textbox.Bind(wx.EVT_CHAR, self.check_key)
# do not use EVT_KEY_DOWN,
# it becomes difficult to get lower case
# self.textbox.Bind(wx.EVT_KEY_DOWN, self.check_key)
# self.Bind(wx.EVT_CLOSE, self.on_close)
self.Bind(wx.EVT_ICONIZE, self.on_iconify)
self.matags = MaTags()
# try:
# except Exception as e:
# self.textbox.ChangeValue(e.args[0].decode('utf8', 'ignore'))
# self.textbox.Disable()
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
wx.Frame.__init__(self, *args, **kwds)
self.label_5 = wx.StaticText(self, wx.ID_ANY, "Cadena Busqueda:")
self.text_ctrl_bucar = wx.TextCtrl(self, wx.ID_ANY, "")
self.button_buscar = wx.Button(self, wx.ID_ANY, "Buscar")
self.label_6 = wx.StaticText(self, wx.ID_ANY, "total VM: 333")
self.bitmap_button_1 = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap("/home/mario/pyvmwareclient/wxglade/recicla.png", wx.BITMAP_TYPE_ANY))
self.list_ctrl_1 = wx.ListCtrl(self, wx.ID_ANY)
self.__set_properties()
self.__do_layout()
# end wxGlade
def updatelastpic(self, lframe):
capsdir = self.capsfolder_box.GetValue()
last_pic = str(capsdir + cap_files[lframe])
if os.path.exists(last_pic):
last_pic = wx.Image(last_pic, wx.BITMAP_TYPE_ANY)
last_pic = self.scale_pic(last_pic, 500)
self.last_pic.SetBitmap(wx.BitmapFromImage(last_pic))
lpicdate = self.date_from_fn(cap_files[lframe])
self.lpic_text.SetLabel('Frame ' + str(lframe) + ' - ' + str(lpicdate))
else:
self.last_pic.SetBitmap(wx.EmptyBitmap(10,10))
self.fpic_text.SetLabel('end')
def updatefirstpic(self, fframe):
capsdir = self.capsfolder_box.GetValue()
first_pic = str(capsdir + cap_files[fframe])
if os.path.exists(first_pic):
first_pic = wx.Image(first_pic, wx.BITMAP_TYPE_ANY)
first_pic = self.scale_pic(first_pic, 500)
fpicdate = self.date_from_fn(cap_files[fframe])
self.fpic_text.SetLabel('Frame ' + str(fframe) + ' - ' + str(fpicdate))
self.first_pic.SetBitmap(wx.BitmapFromImage(first_pic))
else:
self.first_pic.SetBitmap(wx.EmptyBitmap(10,10))
self.fpic_text.SetLabel('start')
def capture_cam_image(self, e):
target_ip = self.tb_ip.GetValue()
target_user = self.tb_user.GetValue()
target_pass = self.tb_pass.GetValue()
cam_capture_choice = self.cam_combo.GetValue()
s_val = str(self.tb_s.GetValue())
c_val = str(self.tb_c.GetValue())
g_val = str(self.tb_g.GetValue())
b_val = str(self.tb_b.GetValue())
x_dim = str(self.tb_x.GetValue())
y_dim = str(self.tb_y.GetValue())
cam_select = self.cam_select_cb.GetValue()
if cam_capture_choice == 'fswebcam':
ctrl_text_string = self.setting_string_tb.GetValue()
ctrl_test_value = self.setting_value_tb.GetValue()
cmd_str = self.cmds_string_tb.GetValue()
if not ctrl_test_value == '':
found_login, cam_output, output_file = take_test_image(target_ip, target_user, target_pass,
s_val, c_val, g_val, b_val,
x_dim, y_dim, cam_select,
cam_capture_choice,
ctrl_test_value=ctrl_test_value, ctrl_text_string=ctrl_text_string, cmd_str=cmd_str)
else:
found_login, cam_output, output_file = take_test_image(target_ip, target_user, target_pass,
s_val, c_val, g_val, b_val,
x_dim, y_dim, cam_select,
cam_capture_choice, cmd_str=cmd_str)
else:
found_login, cam_output, output_file = take_test_image(target_ip, target_user, target_pass,
s_val, c_val, g_val, b_val,
x_dim, y_dim, cam_select,
cam_capture_choice)
photo_location = get_test_pic(target_ip, target_user, target_pass, output_file)
self.main_image.SetBitmap(wx.BitmapFromImage(wx.Image(photo_location, wx.BITMAP_TYPE_ANY)))
def capture_unset_cam_image(self, e):
target_ip = self.tb_ip.GetValue()
target_user = self.tb_user.GetValue()
target_pass = self.tb_pass.GetValue()
x_dim = self.tb_x.GetValue()
y_dim = self.tb_y.GetValue()
cam_select = self.cam_select_cb.GetValue()
extra_args = '' #will be used for camera select
cam_capture_choice = self.cam_combo.GetValue()
found_login, cam_output, output_file = take_unset_test_image(target_ip, target_user, target_pass, x_dim, y_dim, cam_select, cam_capture_choice)
#print cam_output
photo_location = get_test_pic(target_ip, target_user, target_pass, output_file)
#print photo_location
self.main_image.SetBitmap(wx.BitmapFromImage(wx.Image(photo_location, wx.BITMAP_TYPE_ANY)))
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 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 __set_properties(self):
# begin wxGlade: ui_choice2Dialog.__set_properties
self.SetTitle("ChiantiPy")
_icon = wx.EmptyIcon()
imagefile = os.path.join(chianti.__path__[0], "images/chianti2.png")
_icon.CopyFromBitmap(wx.Bitmap(imagefile, wx.BITMAP_TYPE_ANY))
self.SetIcon(_icon)
self.SetSize((448, 556))
# end wxGlade
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 validate_photo(self,path):
import wx
img = wx.Image(path, wx.BITMAP_TYPE_ANY)
# scale the image, preserving the aspect ratio
W=img.GetWidth()
H=img.GetHeight()
if W>120 or H>120 or W<100 or H<100:
return False," Image Height and Width must be between 100-120 pixels"
return [True]
def reset_photo(self,default=False):
print "changing photo"
cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
if default:
path=cur_dir+"/Resources/img/browse.jpg"
else:
path=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"
if not os.path.isfile(path):
path=cur_dir+"/Resources/img/browse.jpg"
if self.path!=path:# changes only if it has changed
self.bitmap_photo = wx.BitmapButton(self.panel_1, wx.ID_ANY,wx.Bitmap(path, wx.BITMAP_TYPE_ANY))
#self.bitmap_photo.SetBitmapSelected( wx.Bitmap(path, wx.BITMAP_TYPE_ANY))
selected_index=0
print self.combo_box_adno.GetSelection()
if self.combo_box_adno.GetSelection()>0:
selected_index=self.combo_box_adno.GetItems().index(self.current_admission_no)
self.__set_properties()
self.__do_layout()
self.combo_box_adno.SetSelection(selected_index)
self.bitmap_photo.Enable(True)
self.path=path
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 __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetTitle(_("frame_1"))
_icon = wx.EmptyIcon()
_icon.CopyFromBitmap(wx.Bitmap("/home/john/Pictures/jasper gui jarvis/jarvisrotator.png", wx.BITMAP_TYPE_ANY))
self.SetIcon(_icon)
# end wxGlade