def __init__(self, parent): """""" Dialog.__init__(self) self.set_transient_for(parent) self.set_icon( self.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU)) self.set_title("Shutting down") self.set_size_request(340, 200) #self.quit = quit self.timeout = TIME_OUT self.cancel = False shut_label = gtk.Label(_("The system is going to shout down.")) self.vbox.pack_start(shut_label, False, False, 10) self.label = gtk.Label(_("Shutting in") + " {0}".format(self.timeout)) self.vbox.pack_start(self.label, False, False, 10) button = gtk.Button(None, gtk.STOCK_CANCEL) self.action_area.pack_start(button) button.connect("clicked", self.on_close) self.connect("response", self.on_close) gobject.timeout_add(1000, self.check_timeout) #Flash if the window is in the background. if cons.OS_WIN: flash_wnd.flash_taskbar_icon(parent.window.handle) self.show_all() self.run()
def __init__(self, parent): """""" Dialog.__init__(self) self.set_transient_for(parent) self.set_icon(self.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU)) self.set_title("Shutting down") self.set_size_request(340, 200) #self.quit = quit self.timeout = TIME_OUT self.cancel = False shut_label = gtk.Label(_("The system is going to shout down.")) self.vbox.pack_start(shut_label, False, False, 10) self.label = gtk.Label(_("Shutting in") + " {0}".format(self.timeout)) self.vbox.pack_start(self.label, False, False, 10) button = gtk.Button(None, gtk.STOCK_CANCEL) self.action_area.pack_start(button) button.connect("clicked", self.on_close) self.connect("response", self.on_close) gobject.timeout_add(1000, self.check_timeout) #Flash if the window is in the background. if cons.OS_WIN: flash_wnd.flash_taskbar_icon(parent.window.handle) self.show_all() self.run()
def __init__(self, service, get_captcha, parent): """""" Dialog.__init__(self) #self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.set_transient_for(parent) self.set_icon( self.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU)) self.set_title("{service_name} captcha".format(service_name=service)) self.set_size_request(340, 200) self.get_captcha = get_captcha self.solution = None self.timeout = TIMEOUT self.cancel = False self.image = gtk.Image() self.vbox.pack_start(self.image) hbox = gtk.HBox() self.vbox.pack_start(hbox, False, False, 10) self.label = gtk.Label(_("Expires in") + " {0}".format(self.timeout)) hbox.pack_start(self.label, True, True, 5) self.entry = gtk.Entry() hbox.pack_start(self.entry, False, False, 10) self.entry.set_width_chars(24) self.entry.set_max_length(40) self.entry.set_activates_default(True) self.entry.connect("activate", self.solve_captcha) button = gtk.Button(None, gtk.STOCK_CANCEL) self.action_area.pack_start(button) self.action_area.set_child_secondary(button, True) #left align. button.connect("clicked", self.on_cancel, parent) button = gtk.Button(None, gtk.STOCK_REFRESH) self.action_area.pack_start(button) button.connect("clicked", self.new_captcha) button = gtk.Button(None, gtk.STOCK_OK) self.action_area.pack_start(button) button.connect("clicked", self.solve_captcha) self.connect("response", self.on_close) self.new_captcha() gobject.timeout_add(1000, self.check_timeout) #Flash if the window is in the background. if cons.OS_WIN: flash_wnd.flash_taskbar_icon(parent.window.handle) self.show_all() self.run()
def __init__(self, service, get_captcha, parent): """""" Dialog.__init__(self) #self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.set_transient_for(parent) self.set_icon(self.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU)) self.set_title("{service_name} captcha".format(service_name=service)) self.set_size_request(340, 200) self.get_captcha = get_captcha self.solution = None self.timeout = TIMEOUT self.cancel = False self.image = gtk.Image() self.vbox.pack_start(self.image) hbox = gtk.HBox() self.vbox.pack_start(hbox, False, False, 10) self.label = gtk.Label(_("Expires in") + " {0}".format(self.timeout)) hbox.pack_start(self.label, True, True, 5) self.entry = gtk.Entry() hbox.pack_start(self.entry, False, False, 10) self.entry.set_width_chars(24) self.entry.set_max_length(40) self.entry.set_activates_default(True) self.entry.connect("activate", self.solve_captcha) button = gtk.Button(None, gtk.STOCK_CANCEL) self.action_area.pack_start(button) self.action_area.set_child_secondary(button, True) #left align. button.connect("clicked", self.on_cancel, parent) button = gtk.Button(None, gtk.STOCK_REFRESH) self.action_area.pack_start(button) button.connect("clicked", self.new_captcha) button = gtk.Button(None, gtk.STOCK_OK) self.action_area.pack_start(button) button.connect("clicked", self.solve_captcha) self.connect("response", self.on_close) self.new_captcha() gobject.timeout_add(1000, self.check_timeout) #Flash if the window is in the background. if cons.OS_WIN: flash_wnd.flash_taskbar_icon(parent.window.handle) self.show_all() self.run()