def create_profile_settings(self, user_profile=None, app=u'admin'): from stoqlib.domain.profile import ProfileSettings if not user_profile: user_profile = self.create_user_profile() return ProfileSettings(store=self.store, app_dir_name=app, has_permission=True, user_profile=user_profile)
def setup_slaves(self): settings = {} for setting in self.model.profile_settings: settings[setting.app_dir_name] = setting apps = get_utility(IApplicationDescriptions) for name, full_name, icon_name, description in apps.get_descriptions(): # Virtual apps should not be selected here if name in ProfileSettings.virtual_apps: continue # Create the user interface for each application which is # a HBox, a CheckButton and an Image box = Gtk.HBox() box.show() button = ProxyCheckButton() button.set_label(full_name) button.data_type = bool button.model_attribute = 'has_permission' button.show() box.pack_start(button, True, True, 6) image = Gtk.Image.new_from_stock(icon_name, Gtk.IconSize.MENU) box.pack_start(image, False, False, 0) image.show() self.applications_vbox.pack_start(box, False, True, 0) model = settings.get(name) if model is None: model = ProfileSettings(store=self.store, has_permission=False, app_dir_name=name, user_profile=self.model) setattr(self, name, button) self.add_proxy(model, [name]) # Scroll to the bottom of the scrolled window vadj = self.scrolled_window.get_vadjustment() vadj.set_value(vadj.get_upper())