def app_table(self): # Labels #info_label = Label("您可以根据自己需要对深度系统在默认情况下使用的程序进行设置") web_label = Label(_("Web")) mail_label = Label(_("Mail")) editor_label = Label(_("Editor")) music_label = Label(_("Music")) movie_label = Label(_("Video")) pic_label = Label(_("Photo")) terminal_label = Label(_("Terminal")) self.web = ComboBox([("None",0)], fixed_width=self.ENTRY_WIDTH) self.mail = ComboBox([("None",0)], fixed_width=self.ENTRY_WIDTH) self.editor = ComboBox([("None",0)], fixed_width=self.ENTRY_WIDTH) self.music = ComboBox([("None",0)], fixed_width=self.ENTRY_WIDTH) self.movie = ComboBox([("None",0)], fixed_width=self.ENTRY_WIDTH) self.pic = ComboBox([("None",0)], fixed_width=self.ENTRY_WIDTH) self.terminal = self.get_terminal_combo() table = gtk.Table(8, 2, False) #table.attach(style.wrap_with_align(info_label), 0, 2, 0, 1) table.attach(style.wrap_with_align(web_label, width=self.LEFT_WIDTH), 0, 1, 1, 2) table.attach(style.wrap_with_align(mail_label, width=self.LEFT_WIDTH), 0, 1, 2, 3) table.attach(style.wrap_with_align(editor_label, width=self.LEFT_WIDTH), 0, 1, 3, 4) table.attach(style.wrap_with_align(music_label, width=self.LEFT_WIDTH), 0, 1, 4, 5) table.attach(style.wrap_with_align(movie_label, width=self.LEFT_WIDTH), 0, 1, 5, 6) table.attach(style.wrap_with_align(pic_label, width=self.LEFT_WIDTH), 0, 1, 6, 7) table.attach(style.wrap_with_align(terminal_label, width=self.LEFT_WIDTH), 0, 1, 7, 8) table.attach(style.wrap_with_align(self.web), 1, 2, 1, 2, 0) table.attach(style.wrap_with_align(self.mail),1, 2, 2, 3, 0) table.attach(style.wrap_with_align(self.editor), 1, 2, 3, 4) table.attach(style.wrap_with_align(self.music), 1, 2, 4, 5) table.attach(style.wrap_with_align(self.movie), 1, 2, 5, 6) table.attach(style.wrap_with_align(self.pic), 1, 2, 6, 7) table.attach(style.wrap_with_align(self.terminal), 1, 2, 7, 8) align = style.set_box_with_align(table, "text") style.set_table(table) self.pack_start(align, False, False) all_app_dict = self.get_all_app() #print all_app_dict apps = [self.web, self.mail, self.editor, self.music, self.movie, self.pic] for app in apps: app.set_size_request(self.ENTRY_WIDTH, 22) for key in all_app_dict.iterkeys(): if self.get_default_app: apps[key].add_items(all_app_dict[key]) else: apps[key].add_items(all_app_dict[key], clear_first = False)
def app_table(self): # Labels #info_label = Label("您可以根据自己需要对深度系统在默认情况下使用的程序进行设置") web_label = Label(_("Web")) mail_label = Label(_("Mail")) editor_label = Label(_("Editor")) music_label = Label(_("Music")) movie_label = Label(_("Video")) pic_label = Label(_("Photo")) terminal_label = Label(_("Terminal")) self.web = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH) self.mail = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH) self.editor = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH) self.music = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH) self.movie = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH) self.pic = ComboBox([("None", 0)], fixed_width=self.ENTRY_WIDTH) self.terminal = self.get_terminal_combo() table = gtk.Table(8, 2, False) #table.attach(style.wrap_with_align(info_label), 0, 2, 0, 1) table.attach(style.wrap_with_align(web_label, width=self.LEFT_WIDTH), 0, 1, 1, 2) table.attach(style.wrap_with_align(mail_label, width=self.LEFT_WIDTH), 0, 1, 2, 3) table.attach( style.wrap_with_align(editor_label, width=self.LEFT_WIDTH), 0, 1, 3, 4) table.attach(style.wrap_with_align(music_label, width=self.LEFT_WIDTH), 0, 1, 4, 5) table.attach(style.wrap_with_align(movie_label, width=self.LEFT_WIDTH), 0, 1, 5, 6) table.attach(style.wrap_with_align(pic_label, width=self.LEFT_WIDTH), 0, 1, 6, 7) table.attach( style.wrap_with_align(terminal_label, width=self.LEFT_WIDTH), 0, 1, 7, 8) table.attach(style.wrap_with_align(self.web), 1, 2, 1, 2, 0) table.attach(style.wrap_with_align(self.mail), 1, 2, 2, 3, 0) table.attach(style.wrap_with_align(self.editor), 1, 2, 3, 4) table.attach(style.wrap_with_align(self.music), 1, 2, 4, 5) table.attach(style.wrap_with_align(self.movie), 1, 2, 5, 6) table.attach(style.wrap_with_align(self.pic), 1, 2, 6, 7) table.attach(style.wrap_with_align(self.terminal), 1, 2, 7, 8) align = style.set_box_with_align(table, "text") style.set_table(table) self.pack_start(align, False, False) all_app_dict = self.get_all_app() #print all_app_dict apps = [ self.web, self.mail, self.editor, self.music, self.movie, self.pic ] for app in apps: app.set_size_request(self.ENTRY_WIDTH, 22) for key in all_app_dict.iterkeys(): if self.get_default_app: apps[key].add_items(all_app_dict[key]) else: apps[key].add_items(all_app_dict[key], clear_first=False)
def init_table(self): table = gtk.Table(8, 3, False) #info_label = Label(_("You can choose the operation after plugining media or device")) cd_label = Label(_("CD")) dvd_label = Label(_("DVD")) player_label = Label(_("Audio Player")) photo_label = Label(_("Camera")) software_label = Label(_("Applications")) auto_mount_label = Label(_("Automatically Mount")) self.all_label_list = [cd_label, dvd_label, player_label, photo_label, software_label] default_list = [(_("Other applications"), "other_app"), (_("Ask"), "ask"), (_("Do nothing"), "do_nothing"), (_("Open folder"),"open_folder")] auto_mount_list = [(_("Do nothing"), "do_nothing"), (_("Ask"), "ask"), (_("Mount"), "mount"), (_("Mount and open folder"), "mount_and_open")] #self.auto_mount_box = gtk.HBox(spacing = WIDGET_SPACING) #self.auto_mount_label = Label(_("apply auto open for all media and devices")) self.auto_mount_label = Label(_("AutoPlay")) self.auto_mount_toggle = ToggleButton(app_theme.get_pixbuf("toggle_button/inactive_normal.png"), app_theme.get_pixbuf("toggle_button/active_normal.png")) #self.auto_mount_box.pack_start(self.auto_mount_label, False, False) #self.auto_mount_box.pack_start(self.auto_mount_toggle, False, False) self.cd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.dvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.player= ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.photo = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.software = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.auto_mount = ComboBox(auto_mount_list, fixed_width=self.ENTRY_WIDTH) self.auto_mount.set_select_index(self.__get_index_from_value(get_auto_mount(), auto_mount_list)) #self.more_option = Button(_("more option")) ###below content type displayed as more option is clicked" self.audio_dvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.blank_bd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.blank_cd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.blank_hddvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.video_bluray = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.ebook_reader = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.video_hddvd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.image_picturecd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.video_svcd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) self.video_vcd = ComboBox(default_list, fixed_width=self.ENTRY_WIDTH) #table.attach(style.wrap_with_align(info_label, width=self.LEFT_WIDTH), 0, 3, 0, 1) table.attach(style.wrap_with_align(cd_label, width=self.LEFT_WIDTH), 0, 1, 4, 5) table.attach(style.wrap_with_align(dvd_label, width=self.LEFT_WIDTH), 0, 1, 5, 6) table.attach(style.wrap_with_align(player_label, width=self.LEFT_WIDTH), 0, 1, 6, 7) table.attach(style.wrap_with_align(photo_label, width=self.LEFT_WIDTH), 0, 1, 7, 8) table.attach(style.wrap_with_align(software_label, width=self.LEFT_WIDTH), 0, 1, 8, 9) table.attach(style.wrap_with_align(auto_mount_label, width=self.LEFT_WIDTH), 0, 1, 9, 10) #table.attach(style.wrap_with_align(self.auto_mount_box, align = "left", left = 180), 0, 3, 1, 2) table.attach(style.wrap_with_align(self.auto_mount_label, width=self.LEFT_WIDTH), 0, 1, 1, 2) table.attach(style.wrap_with_align(self.auto_mount_toggle), 1, 3, 1, 2) table.attach(style.wrap_with_align(self.cd), 1, 3, 4, 5) table.attach(style.wrap_with_align(self.dvd), 1, 3, 5, 6) table.attach(style.wrap_with_align(self.player), 1, 3, 6, 7) table.attach(style.wrap_with_align(self.photo), 1, 3, 7, 8) table.attach(style.wrap_with_align(self.software), 1, 3, 8, 9) table.attach(style.wrap_with_align(self.auto_mount), 1, 3, 9, 10) # UI style table_align = style.set_box_with_align(table, "text") style.set_table(table) self.pack_start(table_align, False, False) combo_list = [self.cd, self.dvd, self.player, self.photo, self.software] for combo in combo_list: combo.set_size_request(self.ENTRY_WIDTH, 22) self.refresh_app_list(default_list) self.media_handle.auto_mount = True if self.media_handle.automount_open: for combo in self.all_app_dict: combo.set_sensitive(True) for l in self.all_label_list: l.set_sensitive(True) else: for combo in self.all_app_dict: combo.set_sensitive(False) for l in self.all_label_list: l.set_sensitive(False) self.auto_mount_toggle.set_active(self.media_handle.automount_open) self.connect_signal_to_combos()