def __init__(self): BaseFrontend.__init__(self) self.db.info('oem-config/text/oem_config') self.previous_excepthook = sys.excepthook sys.excepthook = self.excepthook # Set default language. dbfilter = language.Language(self, self.db) dbfilter.cleanup()
def __init__(self): def add_subpage(self, steps, name): """Inserts a subpage into the notebook. This assumes the file shares the same base name as the page you are looking for.""" gladefile = GLADEDIR + '/' + name + '.glade' gladexml = gtk.glade.XML(gladefile, name) widget = gladexml.get_widget(name) steps.append_page(widget) add_widgets(self, gladexml) gladexml.signal_autoconnect(self) def add_widgets(self, glade): """Makes all widgets callable by the toplevel.""" for widget in glade.get_widget_prefix(""): self.all_widgets.add(widget) setattr(self, widget.get_name(), widget) # We generally want labels to be selectable so that people can # easily report problems in them # (https://launchpad.net/bugs/41618), but GTK+ likes to put # selectable labels in the focus chain, and I can't seem to turn # this off in glade and have it stick. Accordingly, make sure # labels are unfocusable here. if isinstance(widget, gtk.Label): widget.set_property('can-focus', False) elif isinstance(widget, gtk.Button): widget.set_property('use-underline', True) BaseFrontend.__init__(self) self.previous_excepthook = sys.excepthook sys.excepthook = self.excepthook self.all_widgets = set() self.language_questions = ('oem_config', 'language_heading_label', 'step_label', 'back', 'next') self.current_page = None self.username_edited = False self.allowed_change_step = True self.allowed_go_forward = True self.watch = gtk.gdk.Cursor(gtk.gdk.WATCH) self.apply_changes = False # Set default language. dbfilter = language.Language(self, self.debconf_communicator()) dbfilter.cleanup() dbfilter.db.shutdown() if 'OEM_CONFIG_GLADE' in os.environ: gladefile = os.environ['OEM_CONFIG_GLADE'] else: gladefile = '%s/oem-config.glade' % GLADEDIR self.glade = gtk.glade.XML(gladefile) add_widgets(self, self.glade) steps = self.glade.get_widget("steps") for page in self.pages: add_subpage(self, steps, page) def win_size_req(win, req): s = win.get_screen() m = s.get_monitor_geometry(0) w = -1 h = -1 # What's the size of the WM border? total_frame = win.window.get_frame_extents() (cur_x, cur_y, cur_w, cur_h, depth) = win.window.get_geometry() wm_w = total_frame.width - cur_w wm_h = total_frame.height - cur_h if req.width > m.width - wm_w: w = m.width - wm_w if req.height > m.height - wm_h: h = m.height - wm_h win.set_size_request(w, h) win.resize(w, h) if 'OEM_CONFIG_ONLY' in os.environ: self.oem_config.fullscreen() else: self.oem_config.connect('size-request', win_size_req) self.translate_widgets() if 'UBIQUITY_OLD_TZMAP' in os.environ: self.tzmap = TimezoneMap(self) self.tzmap.tzmap.show() else: self.tzdb = oem_config.tz.Database() self.tzmap = timezone_map.TimezoneMap( self.tzdb, '/usr/share/oem-config/pixmaps/timezone') self.tzmap.connect('city-selected', self.select_city) self.timezone_map_window.add(self.tzmap) self.setup_timezone_page() self.tzmap.show() if 'OEM_CONFIG_DEBUG' in os.environ: self.password_debug_warning_label.show()
def __init__(self): def add_subpage(self, steps, name): """Inserts a subpage into the notebook. This assumes the file shares the same base name as the page you are looking for.""" gladefile = GLADEDIR + '/' + name + '.glade' gladexml = gtk.glade.XML(gladefile, name) widget = gladexml.get_widget(name) steps.append_page(widget) add_widgets(self, gladexml) gladexml.signal_autoconnect(self) def add_widgets(self, glade): """Makes all widgets callable by the toplevel.""" for widget in glade.get_widget_prefix(""): self.all_widgets.add(widget) setattr(self, widget.get_name(), widget) # We generally want labels to be selectable so that people can # easily report problems in them # (https://launchpad.net/bugs/41618), but GTK+ likes to put # selectable labels in the focus chain, and I can't seem to turn # this off in glade and have it stick. Accordingly, make sure # labels are unfocusable here. if isinstance(widget, gtk.Label): widget.set_property('can-focus', False) elif isinstance(widget, gtk.Button): widget.set_property('use-underline', True) BaseFrontend.__init__(self) self.previous_excepthook = sys.excepthook sys.excepthook = self.excepthook self.all_widgets = set() self.language_questions = ('oem_config', 'language_heading_label', 'step_label', 'back', 'next') self.current_page = None self.username_edited = False self.allowed_change_step = True self.allowed_go_forward = True self.watch = gtk.gdk.Cursor(gtk.gdk.WATCH) self.apply_changes = False # Set default language. dbfilter = language.Language(self, self.debconf_communicator()) dbfilter.cleanup() dbfilter.db.shutdown() if 'OEM_CONFIG_GLADE' in os.environ: gladefile = os.environ['OEM_CONFIG_GLADE'] else: gladefile = '%s/oem-config.glade' % GLADEDIR self.glade = gtk.glade.XML(gladefile) add_widgets(self, self.glade) steps = self.glade.get_widget("steps") for page in self.pages: add_subpage(self, steps, page) def win_size_req(win, req): s = win.get_screen() m = s.get_monitor_geometry(0) w = -1 h = -1 # What's the size of the WM border? total_frame = win.window.get_frame_extents() (cur_x, cur_y, cur_w, cur_h, depth) = win.window.get_geometry() wm_w = total_frame.width - cur_w wm_h = total_frame.height - cur_h if req.width > m.width - wm_w: w = m.width - wm_w if req.height > m.height - wm_h: h = m.height - wm_h win.set_size_request(w, h) win.resize(w, h) if 'OEM_CONFIG_ONLY' in os.environ: self.oem_config.fullscreen() else: self.oem_config.connect('size-request', win_size_req) self.translate_widgets() if 'UBIQUITY_OLD_TZMAP' in os.environ: self.tzmap = TimezoneMap(self) self.tzmap.tzmap.show() else: self.tzdb = oem_config.tz.Database() self.tzmap = timezone_map.TimezoneMap(self.tzdb, '/usr/share/oem-config/pixmaps/timezone') self.tzmap.connect('city-selected', self.select_city) self.timezone_map_window.add(self.tzmap) self.setup_timezone_page() self.tzmap.show() if 'OEM_CONFIG_DEBUG' in os.environ: self.password_debug_warning_label.show()
def __init__(self): BaseFrontend.__init__(self) self.previous_excepthook = sys.excepthook sys.excepthook = self.excepthook self.debconf_callbacks = {} self.language_questions = ('oem_config', 'language_label', 'language_heading_label', 'timezone_heading_label', 'keyboard_heading_label', 'user_heading_label', 'back', 'next') self.current_step = None # Set default language. dbfilter = language.Language(self, self.debconf_communicator()) dbfilter.cleanup() dbfilter.db.shutdown() self.allowed_change_step = True self.allowed_go_forward = True self.mainLoopRunning = False self.apply_changes = False appName = "oem-config" catalog = "" programName = ki18n("OEM Config") version = "1.0" description = ki18n("Sets up the system") license = KAboutData.License_GPL copyright = ki18n("2006, 2007 Anirudh Ramesh. 2008 Canonical Ltd.") text = ki18n("none") homePage = "http://www.kubuntu.org" bugEmail = "" aboutData = KAboutData(appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) KCmdLineArgs.init(['oem-config', '-style=oxygen'], aboutData) self.app = KApplication() # We want to hide the minimise button if running in the ubiquity-only mode (no desktop) # To achieve this we need to set window flags to Dialog but we also need a parent widget which is showing # else Qt tried to be clever and puts the minimise button back self.parentWidget = QWidget() self.parentWidget.show() # The parent for our actual user interface window, this is needed only because Oxygen widget # style refuses to draw our background on a top level widget self.parent2 = QWidget(self.parentWidget) self.parent2.setAutoFillBackground(True) self.parent2.setWindowState(Qt.WindowFullScreen) self.parent2.setWindowFlags(Qt.Dialog) layout = QVBoxLayout(self.parent2) layout.setContentsMargins(0, 0, 0, 0) self.userinterface = OEMConfUI(self.parent2) self.userinterface.setFrontend(self) layout.addWidget(self.userinterface) self.parent2.show() self.userinterface.next.setIcon(KIcon("go-next")) self.userinterface.back.setIcon(KIcon("go-previous")) self.translate_widgets() self.customize_installer() self.tzmap = TimezoneMap(self) map_vbox = QVBoxLayout(self.userinterface.map_frame) map_vbox.setMargin(0) map_vbox.addWidget(self.tzmap)