def helpScreen(button): log.logMessage(MHELPSCREEN, "", "") window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) window.show() hbox = gtk.HBox(False, 5) window.add(hbox) hbox.show() # padding on the left fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(50, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() # all content goes here vbox = gtk.VBox(False, 5) hbox.pack_start(vbox, True, True) vbox.show() # padding on the right fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(50, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() # BEGIN HELP contents helpfile = open(HELPFILE, "r") helptext = helpfile.read() label = gtk.Label(helptext) label.set_use_markup(True) label.set_size_request(RESOLUTION[0] - 200, -1) label.set_line_wrap(True) label.show() vbox.pack_start(label, False, False) # END HELP contents #~ # padding between help and close button #~ fillervbox = gtk.VBox() #~ vbox.pack_start(fillervbox, True, True) #~ fillervbox.show() # close button button = gtk.Button() button.connect("clicked", closeWindowCbk, window) button.set_size_request(-1, 100) vbox.pack_start(button, False, False) button.show() # close button contents label = gtk.Label('<span size="24000"><b>' + 'Press BACK to go to the main menu' + '</b></span>') label.set_use_markup(True) label.show() button.add(label) # close window after timeout passes gobject.timeout_add(CLOSEWINDOWTIMEOUT, window.destroy)
def burn(button, filename): global GBLprocess global GBLline global GBLoutput global GBLtimeStartedBurn log.logMessage("BeginDiscWrite", "'" + filename + "'", "") showProgressWindow() # close the 'ready to burn' window parentWindow = button.get_parent_window() parentWindow.destroy() command = KA_Program, 'dev=' + KA_Device, '-tao', 'gracetime=0', '-v', '-eject', filename GBLprocess = subprocess.Popen(command, 0, KA_Program, subprocess.PIPE, subprocess.PIPE, subprocess.STDOUT) flags = fcntl.fcntl(GBLprocess.stdout, fcntl.F_GETFL) fcntl.fcntl(GBLprocess.stdout, fcntl.F_SETFL, flags | os.O_NONBLOCK) GBLline = '' GBLoutput = [] GBLtimeStartedBurn = datetime.datetime.now() # have gtk call updateProgress every quarter of a second gobject.timeout_add(250, updateProgress)
def run(): browser = Browser('firefox', profile=config.FIREFOX_PROFILE_PATH) browser.visit('http://www.tf2outpost.com/trades') buttonList = browser.find_by_css(".trade_bump") listSize = len(buttonList) log.logMessage("Bumping " + str(listSize) + " items") for i in range(listSize): buttonList[i].click() browser.quit()
def aboutScreen(button): log.logMessage("HelpScreen", "", "") aboutWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) aboutWindow.set_title("ayuda.html - IdatuxFT") aboutWindow.set_default_size(KA_ScreenResolution[0], KA_ScreenResolution[1]) aboutWindow.fullscreen() # Details view details = webkit.WebView() details.set_editable(False) details.open(KA_AboutFile) scroll = gtk.ScrolledWindow() scroll.add(details) scroll.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_NEVER) # Button bar buttonbar = gtk.Table(1, 1, True) # Back button backbutton = gtk.Button() backbutton.set_focus_on_click(False) backbutton.connect("clicked", close_window) icon = gtk.Image() icon.set_from_file(KA_UIDir + 'details.back.png') label = gtk.Label("<span size='24000'>Menú Principal</span>") label.set_use_markup(True) layout = gtk.HBox(False, 10) layout.pack_start(icon, False, False) layout.pack_start(label, True, True) backbutton.add(layout) buttonbar.attach(backbutton, 0, 1, 0, 1) layout = gtk.VBox() layout.pack_start(scroll, True, True) layout.pack_start(buttonbar, False, False) aboutWindow.add(layout) aboutWindow.show_all() gobject.timeout_add(KA_WindowTimeout, aboutWindow.destroy)
def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy", self.destroy) self.window.set_default_size(RESOLUTION[0], RESOLUTION[1]) def disable_cursor(): # Make the cursor invisible # Find the root gdk window and tweak its cursor. gdkwin = self.window.get_root_window() pixmap = gtk.gdk.Pixmap(None, 1, 1, 1) color = gtk.gdk.Color() cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0) gdkwin.set_cursor(cursor) # We run at fullscreen self.window.fullscreen() # disable_cursor() #Show the window self.window.show() tray_close() mainvbox = gtk.VBox(False, 20) self.window.add(mainvbox) mainvbox.show() vscrollbar = gtk.VScrollbar(adjustment=None) #gap fillerhbox = gtk.HBox(True, 0) fillerhbox.set_size_request(-1, 20) fillerhbox.show() mainvbox.pack_start(fillerhbox, False, False) # Title logo = gtk.Image() logo.set_from_file("logo.png") mainlbl = gtk.Label('<span size="37000"><span face="good times"><b>' + 'FREEDOM TOASTER' + '</b></span></span>') mainlbl.set_use_markup(True) mainlbl.show() mainvbox.pack_start(logo, False, False) mainvbox.pack_start(mainlbl, False, False) logo.show() directionsLbl = gtk.Label( '<span size="12000">' + "Choose the distro you want using the navigational keys and press enter" + '</span>') directionsLbl.set_use_markup(True) mainvbox.pack_start(directionsLbl, False, False) directionsLbl.show() # load the list of available software isoList = isolist.populateIsoList() #isonum = isolist.retnumisos() numButtonsAdded = 0 for iso in isoList: # Use this condition if you want two buttons per row: if numButtonsAdded % 3 == 0: # Use this condition if you want one button per row: #if numButtonsAdded % 2 == 0 or numButtonsAdded % 2 == 1: hbox = gtk.HBox(False, 5) mainvbox.pack_start(hbox) hbox.show() # button for this software button = gtk.Button() button.connect("focus-in-event", highlightbutton) button.connect("key-release-event", highlightbutton) button.connect("key-press-event", unhighlightbutton) button.connect("clicked", readyToBurnScreen, iso) hbox.pack_start(button, True, True) button.set_size_request(25, 25) button.show() # This is unfortunately needed because the text in a label will not # wrap to the size of the parent widget so I have to resize the label # manually. # Set the value depending on how many buttons per row you have and # the size of the image. # For a 1024x768 window: # - with one column and 100px buttons: 850 # - with two columns and 100px buttons: 350 buttonTextWidth = 20 populateButton(button, iso, buttonTextWidth) numButtonsAdded += 1 # More stuff button button = gtk.Button() button.connect("clicked", moreStuff) button.connect("focus-in-event", highlightbutton) button.connect("key-release-event", highlightbutton) button.connect("key-press-event", unhighlightbutton) mainvbox.pack_start(button, True, True) button.show() # More stuff button contents label = gtk.Label('<span size="20000"><b>More stuff</b></span>') label.set_use_markup(True) label.show() button.add(label) #get rid of the mouse cursor # XXX: Why multiple times ? <*****@*****.**> # toaster_display = gtk.gdk.display_get_default() # toaster_screen = toaster_display.get_default_screen() # toaster_display.warp_pointer(toaster_screen,-1,-1) #toaster_screen.get_width()+2,toaster_screen.get_height()+2) log.logMessage(MTOASTERSTART, "", "")
def destroy(self, widget, data=None): print "quitting" log.logMessage(MTOASTEREND, "", "") gtk.main_quit()
def readyToBurnScreen(button, iso): log.logMessage(MISOINFO, "'" + iso.displayname + "'", "'" + iso.filename + "'") window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) # Make sure the button release event gets through # This is for the "button-release-event callback below window.add_events(gtk.gdk.BUTTON_RELEASE_MASK) window.fullscreen() window.show() window.connect("key-press-event", on_key_press) window.connect("button-release-event", on_button_release) hbox = gtk.HBox(False, 5) mainvbox = gtk.VBox(False, 20) window.add(hbox) hbox.show() # padding on the left fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(100, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() # all content goes here vbox = gtk.VBox(False, 5) hbox.pack_start(vbox, True, True) vbox.show() # padding on the right fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(100, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() # iso name label = gtk.Label('<span size="36000"><b>' + iso.displayname + '</b></span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() # box for iso picture and description hbox = gtk.HBox(False, 5) vbox.pack_start(hbox, False, False) hbox.show() # picture image = gtk.Image() image.set_from_file(iso.picture) image.show() hbox.pack_start(image, True, True) # iso description label = gtk.Label('<span size="12000">' + iso.longdescription[0] + '</span>') label.set_use_markup(True) label.set_line_wrap(True) label.set_size_request(RESOLUTION[0] - 400, -1) label.show() hbox.pack_start(label, False, False) #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() if iso.type == 'CD': label = gtk.Label( '<span size="24000"><b>Blank CD or DVD required</b></span>') else: label = gtk.Label( '<span size="24000"><b>Blank DVD required</b></span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() button = gtk.Button() button.connect("clicked", burn.burn, iso.filename) button.connect("focus-in-event", highlightbutton) button.connect("key-press-event", highlightbutton) button.set_size_request(-1, 100) vbox.pack_start(button, False, False) button.show() label = gtk.Label('<span size="24000"><b>' + 'Insert disk and press ENTER to burn' + '</b></span>') label.set_use_markup(True) label.show() button.add(label) button.grab_focus() #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() eject() # close window after timeout passes gobject.timeout_add(CLOSEWINDOWTIMEOUT, window.destroy)
def moreStuff(button): log.logMessage(MMORESTUFF, "", "") morestufflist = morestuff.populateIsoList() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) # Make sure the button release event gets through # This is for the "button-release-event callback below window.add_events(gtk.gdk.BUTTON_RELEASE_MASK) window.connect("key-press-event",on_key_press) window.connect("button-release-event", on_button_release) window.set_flags(gtk.CAN_FOCUS) window.show() # main container that contains the control vbox = gtk.VBox(False, 5) window.add(vbox) vbox.show() #gap fillerhbox = gtk.HBox(True, 0) fillerhbox.set_size_request(-1,20) fillerhbox.show() vbox.pack_start(fillerhbox,False,False) titleLbl = gtk.Label('<span size="33000"><span color="#2c089c"><b><span face="good times">' + 'Zyx' + '</span></b></span></span>' + '<span size="33000" color="#8634e0" face="good times"><b>' + 'ware' + '</b></span>') mainlbl = gtk.Label('<span size="37000"><span face="good times"><b>' + 'FREEDOM TOASTER' + '</b></span></span>') mainlbl.set_use_markup(True) mainlbl.show() titleLbl.set_use_markup(True) vbox.pack_start(titleLbl, False, False) vbox.pack_start(mainlbl, False, False) titleLbl.show() # padding on the top fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 5) vbox.pack_start(fillerhbox, False, False) #fillerhbox.show() # listbox control with list of isos listStore = gtk.ListStore(str, gtk.gdk.Pixbuf) for iso in morestufflist: listStore.append([iso.displayname, gtk.gdk.pixbuf_new_from_file(iso.picture)]) listColumn = gtk.TreeViewColumn() iconRenderer = gtk.CellRendererPixbuf() #iconRenderer.height = 125 iconRenderer.set_fixed_size(125,125) textRenderer = gtk.CellRendererText() textRenderer.set_property("scale", 3) textRenderer.set_property("scale-set", "True") listColumn.pack_start(iconRenderer, True) listColumn.set_attributes(iconRenderer, pixbuf = 1) listColumn.pack_start(textRenderer, True) listColumn.set_attributes(textRenderer, text = 0) listBox = gtk.TreeView(listStore) listBox.append_column(listColumn) listBox.connect("row-activated", onlistBoxSelect) #listBox.connect("key-press-event",on_key_press) scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) vbox.pack_start(scrolledwindow, True, True) scrolledwindow.show() scrolledwindow.add(listBox) #hbox = gtk.HBox(False, 5) #hbox.set_size_request(-1, 200) #hbox.pack_start(listBox, False, False) #vbox.pack_start(hbox, True, True) #hbox.show() listBox.show() # padding on the bottom fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show()
def burnFinished(rc): global progressWindow global caughtErr window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(KA_ScreenResolution[0], KA_ScreenResolution[1]) #window.set_title("burn.py - WLFT-KA") window.set_title("IdatuxFT") window.fullscreen() if rc == 0: title = "Grabación completa!" desc = "Tu disco está listo para que lo uses!." img = "yes" log.logMessage("DiskWriteSuccess", "", "") else: title = "La grabación ha fallado." desc = "Tu disco no pudo ser grabado." img = "no" log.logMessage("DiskWriteFailue", "", "") titleLabel = gtk.Label("<span size='36000'><b>" + title + "</b></span>") titleLabel.set_justify(gtk.JUSTIFY_CENTER) titleLabel.set_selectable(False) titleLabel.set_use_markup(True) image = gtk.Image() image.set_from_file(KA_UIDir + "done." + img + ".png") descLabel = gtk.Label("<span size='14000'>" + desc + "</span>") descLabel.set_justify(gtk.JUSTIFY_CENTER) descLabel.set_line_wrap(True) descLabel.set_selectable(False) descLabel.set_use_markup(True) exit = gtk.Button() exit.set_focus_on_click(False) exit.connect("clicked", closeWindowAndEjectCbk, window) icon = gtk.Image() icon.set_from_file(KA_UIDir + 'details.back.png') label = gtk.Label("<span size='24000'>Menú principal</span>") label.set_use_markup(True) exitlayout = gtk.HBox(False, 10) exitlayout.pack_start(icon, False, False) exitlayout.pack_start(label, True, True) exit.add(exitlayout) vbox = gtk.VBox(False, 10) vbox.pack_start(titleLabel, True, False) vbox.pack_start(image, True, False) vbox.pack_start(descLabel, True, False) vbox.pack_start(exit, False, False) window.add(vbox) window.show_all() closeWindowAndEject(progressWindow) # close window after timeout passes gobject.timeout_add(KA_WindowTimeout, window.destroy)
def readyToBurnScreen(button, iso): log.logMessage(MISOINFO, "'" + iso.displayname + "'", "'" + iso.filename + "'") window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) # Make sure the button release event gets through # This is for the "button-release-event callback below window.add_events(gtk.gdk.BUTTON_RELEASE_MASK) window.show() window.connect("key-press-event",on_key_press) window.connect("button-release-event", on_button_release) hbox = gtk.HBox(False, 5) mainvbox = gtk.VBox(False, 20) window.add(hbox) hbox.show() # padding on the left fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(100, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() # all content goes here vbox = gtk.VBox(False, 5) hbox.pack_start(vbox, True, True) vbox.show() # padding on the right fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(100, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1,20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() # iso name label = gtk.Label('<span size="36000"><b>' + iso.displayname + '</b></span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1,20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() # box for iso picture and description hbox = gtk.HBox(False, 5) vbox.pack_start(hbox, False, False) hbox.show() # picture image = gtk.Image() image.set_from_file(iso.picture) image.show() hbox.pack_start(image, True, True) # iso description label = gtk.Label('<span size="12000">' + iso.longdescription + '</span>') label.set_use_markup(True) label.set_line_wrap(True) label.set_size_request(RESOLUTION[0] - 400, -1) label.show() hbox.pack_start(label, False, False) #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1,20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() if iso.type == 'CD': label = gtk.Label('<span size="24000"><b>Blank CD or DVD required</b></span>') else: label = gtk.Label('<span size="24000"><b>Blank DVD required</b></span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1,20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() button = gtk.Button() button.connect("clicked", burn.burn, iso.filename) button.connect("focus-in-event",highlightbutton) button.connect("key-press-event",highlightbutton) button.set_size_request(-1, 100) vbox.pack_start(button, False, False) button.show() label = gtk.Label('<span size="24000"><b>' + 'Insert disk and press ENTER to burn' + '</b></span>') label.set_use_markup(True) label.show() button.add(label) button.grab_focus() #Horizontal padding fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1,20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show() eject() # close window after timeout passes gobject.timeout_add(CLOSEWINDOWTIMEOUT, window.destroy)
def detailScreen(button, iso): log.logMessage("ViewISODetails", iso.name, iso.file) detailsWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) detailsWindow.set_title(iso.name + " - IdatuxFT") detailsWindow.set_default_size(KA_ScreenResolution[0], KA_ScreenResolution[1]) detailsWindow.fullscreen() # Details view details = webkit.WebView() details.set_editable(False) details.load_html_string("<h1>Cargando URL</h1>", "file:///") details.open(ISO_AvailDir + iso.url) scroll = gtk.ScrolledWindow() scroll.add(details) scroll.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_NEVER) # Button bar buttonbar = gtk.Table(1, 2, True) # Back button backbutton = gtk.Button() backbutton.set_focus_on_click(False) backbutton.connect("clicked", burn.closeWindowAndEjectCbk, detailsWindow) icon = gtk.Image() icon.set_from_file(KA_UIDir + 'details.back.png') label = gtk.Label("<span size='24000'>Menú principal</span>") label.set_use_markup(True) layout = gtk.HBox(False, 10) layout.pack_start(icon, False, False) layout.pack_start(label, True, True) backbutton.add(layout) buttonbar.attach(backbutton, 0, 1, 0, 1) # Burn button burnbutton = gtk.Button() burnbutton.set_focus_on_click(False) burnbutton.connect("clicked", burn.burn, iso.file) icon = gtk.Image() icon.set_from_file(KA_UIDir + 'details.burn.png') label = gtk.Label("<span size='24000'>Grabar Disco</span>") label.set_use_markup(True) os.system("eject ") layout = gtk.HBox(False, 10) layout.pack_start(icon, False, False) layout.pack_start(label, True, True) burnbutton.add(layout) buttonbar.attach(burnbutton, 1, 2, 0, 1) layout = gtk.VBox() layout.pack_start(scroll, True, True) layout.pack_start(buttonbar, False, False) detailsWindow.add(layout) detailsWindow.show_all() gobject.timeout_add(KA_WindowTimeout, detailsWindow.destroy)
def burnFinished(rc): global progressWindow #~ eject() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) window.show() vbox = gtk.VBox(False, 5) window.add(vbox) vbox.show() #gap fillerhbox = gtk.HBox(True, 0) fillerhbox.set_size_request(-1,20) fillerhbox.show() vbox.pack_start(fillerhbox,False,False) titleLbl = gtk.Label('<span size="33000"><span color="#2c089c"><b><span face="good times">' + 'Zyx' + '</span></b></span></span>' + '<span size="33000" color="#8634e0" face="good times"><b>' + 'ware' + '</b></span>') mainlbl = gtk.Label('<span size="37000"><span face="good times"><b>' + 'FREEDOM TOASTER' + '</b></span></span>') mainlbl.set_use_markup(True) mainlbl.show() titleLbl.set_use_markup(True) vbox.pack_start(titleLbl, False, False) vbox.pack_start(mainlbl, False, False) titleLbl.show() window.connect("key-press-event",on_key_press) window.set_destroy_with_parent(True) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, True, True) #fillervbox.set_size_request(-1, 200) fillervbox.show() if rc == 0: msg = 'Writing Completed Successfully :-)' else: msg = 'Writing Failed, Sorry :-(' label = gtk.Label('<span size="36000"><b>' + msg + '</b></span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() if rc == 0: msg = 'Thank you for using the freedom toaster. In case you need any help\n' + \ 'for installing the software you burned, contact Zyxware or ilug-tvm.' log.logMessage(MBURNOK, "", "") else: msg = 'We apologise for the inconvenience, please contact Zyxware Technologies or Trivandrum GNU/Linux Users Group for assistance.\n' log.logMessage(MBURNFAILED, "", "") label = gtk.Label('<span size="14000">' + msg + '</span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() label = gtk.Label('<span size="18000">' + \ 'The toaster was created by Zyxware Technologies' + \ '</span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() label = gtk.Label('<span size="18000">' + 'http://freedomtoaster.in' + '</span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, True, True) fillervbox.show() hbox = gtk.HBox(False, 5) vbox.pack_start(hbox, False, False) hbox.show() fillervbox = gtk.VBox(False, 5) hbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(100, -1) fillervbox.show() button = gtk.Button() button.connect("clicked", closeWindowAndEjectCbk, window) button.set_size_request(-1, 100) hbox.pack_start(button, True, True) button.show() button.grab_focus() button.connect("focus-in-event",highlightbutton) button.connect("key-release-event",highlightbutton) label = gtk.Label('<span size="24000"><b>' + 'Press any key to go back to main menu' + '</b></span>') label.set_use_markup(True) label.show() button.add(label) fillervbox = gtk.VBox(False, 5) hbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(100, -1) fillervbox.show() fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() #~ timeLeftLbl.set_text('<span size="24000"><b>' + msg + '</b></span>') #~ timeLeftLbl.set_use_markup(True) closeWindowAndEject(progressWindow) # close window after timeout passes gobject.timeout_add(CLOSEWINDOWTIMEOUT, window.destroy)
def moreStuff(button): log.logMessage(MMORESTUFF, "", "") morestufflist = morestuff.populateIsoList() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) # Make sure the button release event gets through # This is for the "button-release-event callback below window.add_events(gtk.gdk.BUTTON_RELEASE_MASK) window.connect("key-press-event", on_key_press) window.connect("button-release-event", on_button_release) window.set_flags(gtk.CAN_FOCUS) window.fullscreen() window.show() # main container that contains the control vbox = gtk.VBox(False, 5) window.add(vbox) vbox.show() #gap fillerhbox = gtk.HBox(True, 0) fillerhbox.set_size_request(-1, 20) fillerhbox.show() vbox.pack_start(fillerhbox, False, False) # Title logo = gtk.Image() logo.set_from_file("logo.png") mainlbl = gtk.Label('<span size="37000"><span face="good times"><b>' + 'FREEDOM TOASTER' + '</b></span></span>') mainlbl.set_use_markup(True) mainlbl.show() vbox.pack_start(logo, False, False) vbox.pack_start(mainlbl, False, False) logo.show() # listbox control with list of isos listStore = gtk.ListStore(str, gtk.gdk.Pixbuf) for iso in morestufflist: try: listStore.append( [iso.displayname, gtk.gdk.pixbuf_new_from_file(iso.picture)]) except: listStore.append([ iso.displayname, gtk.gdk.pixbuf_new_from_file(HOMEDIR + '/src/images/default.png') ]) listColumn = gtk.TreeViewColumn() iconRenderer = gtk.CellRendererPixbuf() #iconRenderer.height = 125 iconRenderer.set_fixed_size(125, 125) textRenderer = gtk.CellRendererText() textRenderer.set_property("scale", 3) textRenderer.set_property("scale-set", "True") listColumn.pack_start(iconRenderer, True) listColumn.set_attributes(iconRenderer, pixbuf=1) listColumn.pack_start(textRenderer, True) listColumn.set_attributes(textRenderer, text=0) listBox = gtk.TreeView(listStore) listBox.append_column(listColumn) listBox.connect("row-activated", onlistBoxSelect) #listBox.connect("key-press-event",on_key_press) scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) vbox.pack_start(scrolledwindow, True, True) scrolledwindow.show() scrolledwindow.add(listBox) listBox.show() # padding on the bottom fillerhbox = gtk.HBox(False, 5) fillerhbox.set_size_request(-1, 20) vbox.pack_start(fillerhbox, False, False) fillerhbox.show()
def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy", self.destroy) self.window.set_default_size(RESOLUTION[0], RESOLUTION[1]) def disable_cursor(): # Make the cursor invisible # Find the root gdk window and tweak its cursor. gdkwin = self.window.get_root_window() pixmap = gtk.gdk.Pixmap(None, 1, 1, 1) color = gtk.gdk.Color() cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0) gdkwin.set_cursor(cursor) # We run at fullscreen self.window.fullscreen() # disable_cursor() #Show the window self.window.show() tray_close() mainvbox = gtk.VBox(False, 20) self.window.add(mainvbox) mainvbox.show() vscrollbar = gtk.VScrollbar(adjustment=None) #gap fillerhbox = gtk.HBox(True, 0) fillerhbox.set_size_request(-1,20) fillerhbox.show() mainvbox.pack_start(fillerhbox,False,False) # top middle (title) titleLbl = gtk.Label('<span size="33000"><span color="#2c089c"><b><span face="good times">' + 'Zyx' + '</span></b></span></span>' + '<span size="33000" color="#8634e0" face="good times"><b>' + 'ware' + '</b></span>') mainlbl = gtk.Label('<span size="37000"><span face="good times"><b>' + 'FREEDOM TOASTER' + '</b></span></span>') mainlbl.set_use_markup(True) mainlbl.show() titleLbl.set_use_markup(True) mainvbox.pack_start(titleLbl, False, False) mainvbox.pack_start(mainlbl, False, False) titleLbl.show() directionsLbl = gtk.Label('<span size="12000">' + "Choose the distro you want using the navigational keys and press enter" + '</span>') directionsLbl.set_use_markup(True) mainvbox.pack_start(directionsLbl, False, False) directionsLbl.show() # load the list of available software isoList = isolist.populateIsoList() #isonum = isolist.retnumisos() numButtonsAdded = 0 for iso in isoList: # Use this condition if you want two buttons per row: if numButtonsAdded % 3 == 0: # Use this condition if you want one button per row: #if numButtonsAdded % 2 == 0 or numButtonsAdded % 2 == 1: hbox = gtk.HBox(False, 5) mainvbox.pack_start(hbox) hbox.show() # button for this software button = gtk.Button() button.connect("focus-in-event",highlightbutton) button.connect("key-release-event",highlightbutton) button.connect("key-press-event",unhighlightbutton) button.connect("clicked", readyToBurnScreen, iso) hbox.pack_start(button, True, True) button.set_size_request(25,25) button.show() # This is unfortunately needed because the text in a label will not # wrap to the size of the parent widget so I have to resize the label # manually. # Set the value depending on how many buttons per row you have and # the size of the image. # For a 1024x768 window: # - with one column and 100px buttons: 850 # - with two columns and 100px buttons: 350 buttonTextWidth = 20 populateButton(button, iso, buttonTextWidth) numButtonsAdded += 1 # More stuff button button = gtk.Button() button.connect("clicked", moreStuff) button.connect("focus-in-event",highlightbutton) button.connect("key-release-event",highlightbutton) button.connect("key-press-event",unhighlightbutton) mainvbox.pack_start(button, True, True) button.show() # More stuff button contents label = gtk.Label('<span size="20000"><b>More stuff</b></span>') label.set_use_markup(True) label.show() button.add(label) #get rid of the mouse cursor # XXX: Why multiple times ? <*****@*****.**> # toaster_display = gtk.gdk.display_get_default() # toaster_screen = toaster_display.get_default_screen() # toaster_display.warp_pointer(toaster_screen,-1,-1) #toaster_screen.get_width()+2,toaster_screen.get_height()+2) log.logMessage(MTOASTERSTART, "", "")
def helpScreen(button): log.logMessage(MHELPSCREEN, "", "") window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) window.fullscreen() window.show() hbox = gtk.HBox(False, 5) window.add(hbox) hbox.show() # padding on the left fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(50, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() # all content goes here vbox = gtk.VBox(False, 5) hbox.pack_start(vbox, True, True) vbox.show() # padding on the right fillervbox = gtk.VBox(False, 5) fillervbox.set_size_request(50, -1) hbox.pack_start(fillervbox, False, False) fillervbox.show() # BEGIN HELP contents helpfile = open(HELPFILE, "r") helptext = helpfile.read() label = gtk.Label(helptext) label.set_use_markup(True) label.set_size_request(RESOLUTION[0] - 200, -1) label.set_line_wrap(True) label.show() vbox.pack_start(label, False, False) # END HELP contents #~ # padding between help and close button #~ fillervbox = gtk.VBox() #~ vbox.pack_start(fillervbox, True, True) #~ fillervbox.show() # close button button = gtk.Button() button.connect("clicked", closeWindowCbk, window) button.set_size_request(-1, 100) vbox.pack_start(button, False, False) button.show() # close button contents label = gtk.Label('<span size="24000"><b>' + 'Press BACK to go to the main menu' + '</b></span>') label.set_use_markup(True) label.show() button.add(label) # close window after timeout passes gobject.timeout_add(CLOSEWINDOWTIMEOUT, window.destroy)
def burnFinished(rc): global progressWindow #~ eject() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(RESOLUTION[0], RESOLUTION[1]) window.fullscreen() window.show() vbox = gtk.VBox(False, 5) window.add(vbox) vbox.show() #gap fillerhbox = gtk.HBox(True, 0) fillerhbox.set_size_request(-1,20) fillerhbox.show() vbox.pack_start(fillerhbox,False,False) logo = gtk.Image() logo.set_from_file("logo.png") mainlbl = gtk.Label('<span size="37000"><span face="good times"><b>' + 'FREEDOM TOASTER' + '</b></span></span>') mainlbl.set_use_markup(True) mainlbl.show() vbox.pack_start(logo, False, False) vbox.pack_start(mainlbl, False, False) logo.show() window.connect("key-press-event",on_key_press) window.set_destroy_with_parent(True) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, True, True) #fillervbox.set_size_request(-1, 200) fillervbox.show() if rc == 0: msg = 'Writing Completed Successfully :-)' else: msg = 'Writing Failed, Sorry :-(' label = gtk.Label('<span size="36000"><b>' + msg + '</b></span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() if rc == 0: msg = 'Thank you for using the freedom toaster. In case you need any help\n' + \ 'for installing the software you burned, contact Zyxware or FSUG-TVPM.' log.logMessage(MBURNOK, "", "") else: msg = 'We apologise for the inconvenience, please contact Zyxware Technologies or Thiruvananthapuram Free Software Users Group for assistance.\n' log.logMessage(MBURNFAILED, "", "") label = gtk.Label('<span size="14000">' + msg + '</span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() label = gtk.Label('<span size="18000">' + \ 'The toaster was created by Zyxware Technologies' + \ '</span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() label = gtk.Label('<span size="18000">' + 'www.freedomtoaster.in' + '</span>') label.set_use_markup(True) label.show() vbox.pack_start(label, False, False) fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, True, True) fillervbox.show() hbox = gtk.HBox(False, 5) vbox.pack_start(hbox, False, False) hbox.show() fillervbox = gtk.VBox(False, 5) hbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(100, -1) fillervbox.show() button = gtk.Button() button.connect("clicked", closeWindowAndEjectCbk, window) button.set_size_request(-1, 100) hbox.pack_start(button, True, True) button.show() button.grab_focus() button.connect("focus-in-event",highlightbutton) button.connect("key-release-event",highlightbutton) label = gtk.Label('<span size="24000"><b>' + 'Press any key to go back to main menu' + '</b></span>') label.set_use_markup(True) label.show() button.add(label) fillervbox = gtk.VBox(False, 5) hbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(100, -1) fillervbox.show() fillervbox = gtk.VBox(False, 5) vbox.pack_start(fillervbox, False, False) fillervbox.set_size_request(-1, 20) fillervbox.show() #~ timeLeftLbl.set_text('<span size="24000"><b>' + msg + '</b></span>') #~ timeLeftLbl.set_use_markup(True) closeWindowAndEject(progressWindow) # close window after timeout passes gobject.timeout_add(CLOSEWINDOWTIMEOUT, window.destroy)