def __init__(self): DialogBox.__init__( self, _("Lyrics search"), 460, 300, DIALOG_MASK_MULTIPLE_PAGE, close_callback=self.hide_all, modal=False, window_hint=None, skip_taskbar_hint=False, window_pos=gtk.WIN_POS_CENTER) self.artist_entry = InputEntry() self.artist_entry.set_size(130, 23) self.title_entry = InputEntry() self.title_entry.set_size(130, 23) artist_label = Label(_("Artist:")) title_label = Label(_("Title:")) right_align = gtk.Alignment() right_align.set(0, 0, 0, 1) self.search_button = Button(_("Search")) self.search_button.connect("clicked", self.search_lyric_cb) self.process_id = 0 info_box = gtk.HBox(spacing=25) control_box = gtk.HBox(spacing=5) title_box = gtk.HBox(spacing=5) title_box.pack_start(title_label, False, False) title_box.pack_start(self.title_entry) artist_box = gtk.HBox(spacing=5) artist_box.pack_start(artist_label, False, False) artist_box.pack_start(self.artist_entry) control_box.pack_start(title_box, False, False) control_box.pack_start(artist_box, False, False) info_box.pack_start(control_box, False, False) info_box.pack_start(self.search_button, False, False) sort_items = [ lambda items, reverse : self.sort_by_key(items, reverse, "title"), lambda items, reverse : self.sort_by_key(items, reverse, "artist")] self.result_view = TreeView() self.result_view.set_expand_column(0) self.result_view.connect("double-click-item", self.double_click_cb) self.result_view.set_column_titles([_("Title"), _("Artist")], sort_items) self.result_view.draw_mask = self.draw_view_mask self.prompt_label = Label("") download_button = Button(_("Download")) download_button.connect("clicked", self.download_lyric_cb) cancel_button = Button(_("Close")) cancel_button.connect("clicked", lambda w: self.hide_all()) info_box_align = gtk.Alignment() info_box_align.set_padding(5, 0, 5, 0) info_box_align.add(info_box) self.body_box.set_spacing(5) self.body_box.pack_start(info_box_align, False, False) self.body_box.pack_start(self.result_view, True, True) self.left_button_box.set_buttons([self.prompt_label]) self.right_button_box.set_buttons([download_button, cancel_button]) self.lrc_manager = LrcManager()
def row_input_entry(self, label_name, table=None): label = self.__label(label_name) entry = InputEntry() entry.set_size(self.right_width, WIDGET_HEIGHT) self._wrap_align((label, entry), table) return entry
def __init__( self, padding_left=0, ): CycleStrip.__init__(self, app_theme.get_pixbuf("strip/background.png")) self.label = Label() self.label_align = gtk.Alignment() self.label_align.set(0.0, 0.5, 0, 0) self.label_align.set_padding(0, 0, padding_left, 0) self.label_align.add(self.label) self.search_button = ImageButton( app_theme.get_pixbuf("entry/search_normal.png"), app_theme.get_pixbuf("entry/search_hover.png"), app_theme.get_pixbuf("entry/search_press.png"), ) self.search_entry = InputEntry(action_button=self.search_button) self.search_entry.set_size(220, 24) entry_align = gtk.Alignment(0.5, 0.5, 0, 0) entry_align.set_padding(0, 0, 5, 5) entry_align.add(self.search_entry) self.pack_start(self.label_align, True, True) self.pack_start(entry_align, False, False)
def create_combo_entry(self, top_attach, bottom_attach, label_text, content_text=""): title_label_box = gtk.HBox() title_label = Label("%s:" % label_text) title_label_box.pack_start(create_right_align(), False, True) title_label_box.pack_start(title_label, False, True) content_entry = InputEntry(content_text) content_entry.set_size(260, 25) self.main_table.attach(title_label_box, 0, 1, top_attach, bottom_attach, xoptions=gtk.FILL) self.main_table.attach(content_entry, 1, 2, top_attach, bottom_attach, xoptions=gtk.FILL) return content_entry
def __init_ui(self): #self.check_bar = Imag\cceBox(app_theme.get_pixbuf("network/check_box-2.png")) self.ssid_label = Label(_("SSID:")) self.ssid_entry = InputEntry("Deepin.org") self.ssid_entry.entry.set_size_request(200 ,22) self.password_label = Label(_("Password:"******"") self.password_entry.entry.set_size_request(200 ,22) self.active_btn = Button(_("Active")) self.jump_bar = ImageButton(app_theme.get_pixbuf("network/jump_to.png"), app_theme.get_pixbuf("network/jump_to.png"), app_theme.get_pixbuf("network/jump_to.png")) self.check_bar_align = gtk.Alignment(0, 0, 0, 0) self.check_bar_align.set_size_request(36, 30) self.check_bar_align.connect("expose-event", self.expose_state) #check_bar_align = self.__wrap_align(self.check_bar, (0, 0, 10, 10)) ssid_label_align = self.__wrap_align(self.ssid_label, (0, 0, 0, 10)) self.ssid_entry_align = self.__wrap_align(self.ssid_entry) password_label_align = self.__wrap_align(self.password_label, (0, 0, 20, 10)) self.password_entry_align = self.__wrap_align(self.password_entry) self.active_align = gtk.Alignment(1, 0.5, 0, 0) self.active_align.set_padding(0, 0, 0, 10) self.active_align.add(self.active_btn) self.__pack_begin(self, [self.check_bar_align, ssid_label_align, self.ssid_entry_align, password_label_align, self.password_entry_align ]) self.ssid_entry_align.set_size_request(200, 30) self.password_entry_align.set_size_request(200, 30) self.pack_end(self.active_align, False, True) self.show_all() self.active_btn.connect("clicked", self.active_btn_callback) #self.password_entry.expose_input_entry = self.expose_input_entry self.check_out_pixbuf = app_theme.get_pixbuf('network/check_box_out.png') self.loading_pixbuf = app_theme.get_pixbuf('network/loading.png') self.check_pixbuf = app_theme.get_pixbuf('network/check_box-2.png') #self.check_bar = ImageBox(app_theme.get_pixbuf("network/"+pixbufs[state])) self.position = 1 self.net_state = 0
def set_table_items(table, item_name): children = table.get_children() for child in children: if item_name is "entry": from dtk.ui.entry import InputEntry, PasswordEntry if type(child) is gtk.Alignment: c = child.get_children()[0] if type(c).__name__ == type(InputEntry()).__name__ or \ type(c).__name__ == type(PasswordEntry()).__name__: c.set_size(222, WIDGET_HEIGHT)
def add_new_box(self): table = gtk.Table() #hbox.set_size_request(-1, 30) name_label = Label(_("Name:"), enable_select=False) name_label.set_can_focus(False) exec_label = Label(_("Exec:"), enable_select=False) exec_label.set_can_focus(False) desc_label = Label(_("Comment:"), enable_select=False) desc_label.set_can_focus(False) self.name_entry = InputEntry() self.exec_entry = InputEntry() self.desc_entry = InputEntry() self.name_entry.set_size(200, 22) self.exec_entry.set_size(200, 22) self.desc_entry.set_size(200, 22) name_label_align = self.wrap_with_align(name_label) exec_label_align = self.wrap_with_align(exec_label) desc_label_align = self.wrap_with_align(desc_label) name_align = style.wrap_with_align(self.name_entry) exec_align = style.wrap_with_align(self.exec_entry) desc_align = style.wrap_with_align(self.desc_entry) table = gtk.Table(3, 4) self.table_add(table, [name_label_align, exec_label_align, desc_label_align], 0) self.table_add(table, [name_align, exec_align, desc_align], 1) open_folder = ImageButton(self.icon_pixbuf, self.icon_pixbuf, self.icon_pixbuf) open_folder.connect( "clicked", lambda w: OpenFileDialog( "Choose file", self, ok_callback=self.ok_callback)) table.attach(style.wrap_with_align(open_folder), 2, 3, 1, 2) align = gtk.Alignment(0.5, 0, 0, 0) style.set_table(table) align.add(table) return align
def create_output_box(self): output_label = Label("%s:" % _("Output")) self.output_entry = InputEntry(os.path.expanduser("~/")) self.output_entry.set_size(210, 24) change_button = Button(_("Change")) change_button.connect("clicked", self.set_output_directory) output_box = gtk.HBox(spacing=5) output_box.pack_start(output_label, False, False) output_box.pack_start(self.output_entry, False, False) output_box.pack_start(change_button, False, False) return output_box
def add_ssid_entry(self): self.wireless = self.connection.get_setting("802-11-wireless") self.ssid_label = Label(_("SSID:"), enable_select=False, enable_double_click=False) self.ssid_label_align = style.wrap_with_align(self.ssid_label, width=210) self.ssid_entry = InputEntry() self.ssid_entry.set_size(self.ENTRY_WIDTH, 22) self.ssid_entry_align = style.wrap_with_align(self.ssid_entry, align="left") self.ssid_entry.entry.connect("changed", self.set_ssid) self.ssid_entry.set_text(self.wireless.ssid)
def create_location_box(self): location_align = gtk.Alignment() location_align.set(1.0, 1.0, 0.5, 0.5) location_box = gtk.HBox(spacing=5) location_label = Label("%s" % _("Location")) self.location_entry = InputEntry("") self.location_entry.set_size(250, 25) open_button = Button(_("Open directory")) open_button.connect("clicked", self.open_song_location) location_box.pack_start(location_label, False, True) location_box.pack_start(self.location_entry, False, True) location_box.pack_start(open_button, False, True) location_align.add(location_box) return location_align
def __set_row(self, name, arg, types="ip"): label = Label(name, text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) entry = InputEntry() if types == "ip": #print "ip row changed" entry.entry.connect("changed", self.set_ip_address, arg) else: #print "dns row changed" entry.entry.connect("changed", self.set_dns_address, arg) entry.set_size(self.ENTRY_WIDTH, WIDGET_HEIGHT) return (label, entry)
def __init__(self): DialogBox.__init__(self, _("Open Url"), mask_type=DIALOG_MASK_MULTIPLE_PAGE, window_pos=gtk.WIN_POS_CENTER ) self.hbox_ali = gtk.Alignment(0, 0, 1, 1) self.hbox_ali.set_padding(5, 5, 5, 5) self.hbox = gtk.HBox() self.hbox_ali.add(self.hbox) self.url_text = InputEntry() self.ok_btn = Button(_("Ok")) self.cancel_btn = Button(_("Cancel")) self.url_text.set_size(280, 25) self.hbox.pack_start(self.url_text, True, True) #self.hbox.pack_start(self.ok_btn, True, True, 5) self.right_button_box.set_buttons([self.ok_btn, self.cancel_btn]) # self.body_box.pack_start(self.hbox_ali, True, True) # self.cancel_btn.connect("clicked", self.__cancel_btn_clicked_event)
def create_download_dir_table(self): main_table = gtk.Table(4, 2) main_table.set_row_spacings(CONTENT_ROW_SPACING) dir_title_label = Label(_("Download settings")) dir_title_label.set_size_request(200, 12) label_align = gtk.Alignment() label_align.set_padding(0, 0, 0, 0) label_align.add(dir_title_label) download_number_label = Label(_('Maximum number of download tasks: ')) self.download_number_comobox = ComboBox( items = [(str(i+1), i+1) for i in range(10)], select_index = int(get_download_number())-1, ) self.download_number_comobox.connect("item-selected", self.download_number_comobox_changed) download_number_hbox = gtk.HBox(spacing=5) download_number_hbox.pack_start(download_number_label, False, False) download_number_hbox.pack_start(self.download_number_comobox, False, False) change_download_dir_label = Label(_("Download directory: ")) self.dir_entry = InputEntry() self.dir_entry.set_text(get_software_download_dir()) self.dir_entry.set_editable(False) self.dir_entry.set_size(200, 25) modify_button = Button(_("Change")) modify_button.connect("clicked", self.change_download_save_dir) download_dir_hbox = gtk.HBox(spacing=5) download_dir_hbox.pack_start(change_download_dir_label, False, False) download_dir_hbox.pack_start(self.dir_entry, False, False) download_dir_hbox.pack_start(modify_button, False, False) main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL) main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL) main_table.attach(download_number_hbox, 0, 2, 2, 3, xoptions=gtk.FILL) main_table.attach(download_dir_hbox, 0, 2, 3, 4, xoptions=gtk.FILL) return main_table
def __row_entry_spin(self, label_name, table, types): label = Label(label_name, text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) label.set_can_focus(False) label_align = style.wrap_with_align(label, width=260) entry = InputEntry() entry.set_size(self.ENTRY_WIDTH, 22) spin = SpinBox(0, 0, 49151, 1, 60) spin.value_entry.connect("changed", lambda w, v: spin.update_and_emit(int(v))) hbox = gtk.HBox(spacing=10) hbox.set_size_request(-1, 22) hbox_align = style.wrap_with_align(hbox, align="left") hbox.pack_start(entry) hbox.pack_start(spin) table.row_attach((label_align, hbox_align)) return [entry, spin]
def __init__(self, title, ok_cb=None, cancel_cb=None): BluetoothDialog.__init__(self, title) self.ok_cb = ok_cb self.cancel_cb = cancel_cb self.input_entry_align = gtk.Alignment() self.input_entry_align.set_padding(20, 20, 5, 5) self.input_entry = InputEntry("") self.input_entry.set_size(500, 25) self.ok_button = Button(_("OK")) self.ok_button.connect("clicked", self.__ok_callback) self.cancel_button = Button(_("Cancel")) self.cancel_button.connect("clicked", self.__cancel_callback) self.input_entry_align.add(self.input_entry) self.vbox.pack_end(self.input_entry_align) self.add_dtk_button(self.ok_button, gtk.RESPONSE_OK) self.add_dtk_button(self.cancel_button, gtk.RESPONSE_CANCEL) self.input_entry.entry.connect("press-return", ok_cb, self.input_entry.get_text())
def __init__(self, settings_obj=None): gtk.VBox.__init__(self) #self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) #Dispatcher.set_button = set_button_callback #self.module_frame = module_frame # 新增settings_obj变量,用于访问shared_methods.Settings对象 self.settings_obj = settings_obj self.method_title = TitleBar(None, _("Configure Method"), width=self.TABLE_WIDTH, has_separator=False) self.refuse_eap_label = Label(_("EAP"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.refuse_pap_label = Label(_("PAP"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.refuse_chap_label = Label(_("CHAP"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.refuse_mschap_label = Label(_("MSCHAP"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.refuse_mschapv2_label = Label(_("MSCHAP v2"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.refuse_eap = SwitchButton() self.refuse_pap = SwitchButton() self.refuse_chap = SwitchButton() self.refuse_mschap = SwitchButton() self.refuse_mschapv2 = SwitchButton() self.method_table = gtk.Table(23, 3, False) # visible settings self.compression_title = TitleBar(None, _("Compression"), width=self.TABLE_WIDTH, has_separator=False) self.echo_title = TitleBar(None, _("Echo"), width=self.TABLE_WIDTH, has_separator=False) #compressio))n = Label(_("Compression"), text_size=TITLE_FONT_SIZE) self.require_mppe_label = Label( _("Use point-to-point encryption(mppe)"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.require_mppe_128_label = Label(_("Require 128-bit encryption"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.mppe_stateful_label = Label(_("Use stateful MPPE"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.nobsdcomp_label = Label(_("Allow BSD data Compression"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.nodeflate_label = Label(_("Allow Deflate data compression"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.no_vj_comp_label = Label(_("Use TCP header compression"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) #echo = Label("Echo", text_size=TITLE_FONT_SIZE) self.ppp_echo_label = Label(_("Send PPP echo packets"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.nopcomp_label = Label( _("Use protocal field compression negotiation"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.noaccomp_label = Label(_("Use Address/Control compression"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.require_mppe = SwitchButton() self.require_mppe_128 = SwitchButton() self.mppe_stateful = SwitchButton() self.nobsdcomp = SwitchButton() self.nodeflate = SwitchButton() self.no_vj_comp = SwitchButton() self.nopcomp = SwitchButton() self.noaccomp = SwitchButton() self.ppp_echo = SwitchButton() self.ip_sec_enable = SwitchButton() ## Settings for IPSec self.ipsec_title = TitleBar(None, _("IPSec Setting"), width=self.TABLE_WIDTH, has_separator=False) self.ip_sec_enable_label = Label(_("Enable IPSec tunnel to l2tp host"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.group_name_label = Label(_("Group Name:"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.gateway_id_label = Label(_("Gateway ID:"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.pre_shared_key_label = Label(_("Pre_Shared_key"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.group_name = InputEntry() self.group_name.set_size(self.TABLE_WIDTH, 22) self.gateway_id = InputEntry() self.gateway_id.set_size(self.TABLE_WIDTH, 22) self.pre_shared_key = PasswordEntry() self.pre_shared_key.set_text = self.pre_shared_key.entry.set_text self.pre_shared_key.set_size(self.TABLE_WIDTH, 22) methods_list = [ "refuse_eap", "refuse_eap_label", "refuse_pap", "refuse_pap_label", "refuse_chap", "refuse_chap_label", "refuse_mschap", "refuse_mschap_label", "refuse_mschapv2", "refuse_mschapv2_label" ] compression_list = [ "require_mppe_label", "require_mppe", "require_mppe_128_label", "require_mppe_128", "mppe_stateful_label", "mppe_stateful", "nobsdcomp_label", "nobsdcomp", "nodeflate_label", "nodeflate", "no_vj_comp_label", "no_vj_comp", "nopcomp_label", "nopcomp", "noaccomp_label", "noaccomp" ] echo_list = ["ppp_echo_label", "ppp_echo"] ip_sec_list = [ "ip_sec_enable_label", "ip_sec_enable", "group_name_label", "group_name", "gateway_id_label", "gateway_id", "pre_shared_key_label", "pre_shared_key" ] for name in (compression_list + echo_list + methods_list + ip_sec_list): widget = getattr(self, name) if not name.endswith("label"): align = style.wrap_with_align(widget, align="left") else: align = style.wrap_with_align(widget, width=210) setattr(self, name + "_align", align) #vbox = gtk.VBox() table_align = gtk.Alignment(0, 0, 0, 0) table_align.add(self.method_table) style.set_table(self.method_table) self.pack_start(table_align, False, False) self.method_table.set_row_spacing(5, 20) self.method_table.set_row_spacing(15, 20) self.method_table.set_row_spacing(18, 20) Dispatcher.connect("vpn-type-change", lambda w, c: self.refresh(c))
def InitializeComponent(self): # Init form event. # self.connect("destroy", lambda w : self.destroy()) self.connect("destroy", lambda w: self.hide_all()) # Init widgets. self.brand_label = Label("%s: " % _("Phone brand")) self.format_label = Label("%s: " % _("Output format")) self.bit_rate_label = Label("%s: " % _("Audio encoder")) self.frame_rate_label = Label("%s: " % _("Video encoder")) self.path_label = Label("%s: " % _("Output directory")) self.model_label = Label("%s: " % _("Phone model")) self.ratio_label = Label(' %s: ' % _("Resolution")) self.path_entry = InputEntry() self.save_path_entry = InputEntry() fixed_width = 108 self.brand_combo = NewComboBox(fixed_width) self.format_combo = NewComboBox(fixed_width) self.bit_rate_combo = NewComboBox(fixed_width) self.frame_rate_combo = NewComboBox(fixed_width) self.model_combo = NewComboBox(fixed_width) self.ratio_combo = NewComboBox(fixed_width) self.modify_chooser_btn = FileChooserButton( "选择") # connect self.FileChooser self.save_chooser_btn = Button(_("Change")) self.start_btn = Button(_("Start")) self.close_btn = Button(_("Close")) self.higt_set_bool = False self.higt_set_btn = LabelButton() #Button(_("Advanced")) self.show_and_hide_task_btn = Button(_("Task Manager")) self.higt_hbox = gtk.HBox() self.higt_hbox.pack_start(self.higt_set_btn) self.higt_align = gtk.Alignment() self.higt_align.add(self.higt_hbox) self.higt_align.set_padding(0, 0, 7, 0) self.higt_align.set(1, 0, 1, 0) self.left_button_box.set_buttons([self.higt_align]) self.right_button_box.set_buttons([self.start_btn, self.close_btn]) # ratio_combo. self.__ratio_list = [ "176 x 220", "240 x 320", "320 x 240", "320 x 480", "400 x 240", "480 x 800", "540 x 960", "600 x 1024", "640 x 480", "720 x 1280", "800 x 480", "800 x 600", "1024 x 600", "1024 x 768", "1152 x 864", ] self.ratio_items = [] for ratio in self.__ratio_list: self.ratio_combo.append_text(ratio) self.ratio_items.append((ratio, ratio)) self.ratio_combo.set_active(5) # brand_combo. brand_items = [] for brand in self.read_xml.brand_dict.keys(): brand_po = brand if self.brand_dict.has_key(brand): brand_po = self.brand_dict[brand] brand_items.append((brand_po, brand)) self.brand_combo.set_items(brand_items, 0) #self.brand_combo.add_items(brand_items, 0) self.brand_combo.prepend_text(_("No Presets")) self.brand_combo.connect("changed", self.brand_combo_item_selected) # model_combo. self.model_label.set_sensitive(False) self.model_combo.set_sensitive(False) self.model_combo.prepend_text(_("No Model")) self.model_combo.connect("changed", self.model_combo_item_selected) # self.save_chooser_btn.set_size_request(75, 21) self.save_chooser_btn.connect("clicked", self.save_chooser_btn_clicked) # path_entry. PATH_ENTRY_WIDTH = 240 PATH_ENTRY_HEIGHT = 22 self.save_path_entry.set_sensitive(False) self.save_path_entry.set_text(self.get_home_path()) self.save_path_entry.set_size(PATH_ENTRY_WIDTH, PATH_ENTRY_HEIGHT) self.close_btn.connect("clicked", lambda w: self.hide_all()) # higt_set_btn. self.higt_set_btn.connect("clicked", self.higt_set_btn_clicked) # form body box add main fixed. self.body_table_ali = gtk.Alignment() self.body_table_ali.set_padding(6, 0, 0, 0) self.body_table = gtk.Table(rows=6, columns=4, homogeneous=False) self.body_table_ali.add(self.body_table) self.brand_model_hbox = gtk.HBox() top, bottom = 5, 5 brand_position = eval(_("('brand_position', 20)")) model_position = eval(_("('model_position', 20)")) self.brand_hbox_ali, self.brand_hbox = self.create_hbox( bottom, top, 15 + int(brand_position[1]), 0, self.brand_label, self.brand_combo) self.model_hbox_ali, self.model_hbox = self.create_hbox( bottom, top, 50 - int(model_position[1]), 0, self.model_label, self.model_combo) self.brand_model_hbox.pack_start(self.brand_hbox_ali, False, False) self.brand_model_hbox.pack_start(self.model_hbox_ali, False, False) format_position = eval(_("('format_position', 12)")) ratio_position = eval(_("('ratio_position', 18)")) self.format_hbox_ali, self.format_hbox = self.create_hbox( bottom, top, 15 + int(format_position[1]), 0, self.format_label, self.format_combo) self.ratio_hbox_ali, ratio_hbox = self.create_hbox( bottom, top, 50 - int(ratio_position[1]), 0, self.ratio_label, self.ratio_combo) self.format_ratio_hbox = gtk.HBox() self.format_ratio_hbox.pack_start(self.format_hbox_ali, False, False) self.format_ratio_hbox.pack_start(self.ratio_hbox_ali, False, False) frame_rate_position = eval(_("('frame_position', 13)")) bit_rate_position = eval(_("('bit_rate_position', 28)")) self.frame_rate_hbox_ali, self.frame_rate_hbox = self.create_hbox( bottom, top, 15 + int(frame_rate_position[1]), 0, self.frame_rate_label, self.frame_rate_combo) self.bit_rate_hbox_ali, self.bit_rate_hbox = self.create_hbox( bottom, top, 50 - int(bit_rate_position[1]), 0, self.bit_rate_label, self.bit_rate_combo) self.bit_frame_hbox = gtk.HBox() self.bit_frame_hbox.pack_start(self.frame_rate_hbox_ali, False, False) self.bit_frame_hbox.pack_start(self.bit_rate_hbox_ali, False, False) # self.path_label, self.save_path_entry, self.save_chooser_btn self.save_path_hbox_ali = gtk.Alignment() self.save_path_hbox = gtk.HBox() self.save_path_hbox_ali.set_padding(5, 5, 16, 0) self.save_path_hbox_ali.add(self.save_path_hbox) self.save_path_entry_ali = gtk.Alignment() self.save_path_entry_ali.set_padding(1, 0, 0, 0) self.save_path_entry_ali.add(self.save_path_entry) self.save_chooser_btn_ali = gtk.Alignment() self.save_chooser_btn_ali.set_padding(0, 0, 10, 0) self.save_chooser_btn_ali.add(self.save_chooser_btn) self.save_path_hbox.pack_start(self.path_label, False, False) self.save_path_hbox.pack_start(self.save_path_entry_ali, False, False) self.save_path_hbox.pack_start(self.save_chooser_btn_ali, False, False) # left right top, bottom. '''brand_model_hbox.''' # self.body_table.attach(self.brand_model_hbox, 0, 1, 0, 1, gtk.EXPAND, gtk.EXPAND) self.body_table.attach(self.brand_model_hbox, 0, 1, 0, 1, gtk.FILL, gtk.FILL) # self.body_table.attach(self.model_hbox, 1, 2, 0, 1, gtk.EXPAND, gtk.EXPAND) # self.body_table.attach(self.model_hbox, 2, 3, 0, 1, gtk.EXPAND, gtk.EXPAND) # self.body_table.attach(self.model_hbox, 3, 4, 0, 1, gtk.EXPAND, gtk.EXPAND) '''format_ratio_hbox.''' # self.body_table.attach(self.format_ratio_hbox, 0, 1, 1, 2, gtk.EXPAND, gtk.EXPAND) self.body_table.attach(self.format_ratio_hbox, 0, 1, 1, 2, gtk.FILL, gtk.FILL) # self.body_table.attach(self.format_combo, 1, 2, 1, 2, gtk.EXPAND, gtk.EXPAND) # self.body_table.attach(self.ratio_hbox, 2, 3, 1, 2, gtk.EXPAND, gtk.EXPAND) # self.body_table.attach(self.ratio_combo, 3, 4, 1, 2, gtk.EXPAND, gtk.EXPAND) '''bit_frame_hbox.''' # self.body_table.attach(self.bit_frame_hbox, 0, 1, 2, 3, gtk.EXPAND, gtk.EXPAND) self.body_table.attach(self.bit_frame_hbox, 0, 1, 2, 3, gtk.FILL, gtk.FILL) '''save_path_hbox.''' # self.body_table.attach(self.save_path_hbox_ali, 0, 1, 3, 4, gtk.EXPAND, gtk.EXPAND) self.body_table.attach(self.save_path_hbox_ali, 0, 1, 3, 4, gtk.FILL, gtk.FILL) self.body_box.pack_start(self.body_table_ali, True, True) self.hide_setting()
''' # Add volume button. volume_button = VolumeButton(100, 50) volume_frame = gtk.Alignment() volume_frame.set(0.0, 0.5, 0, 0) volume_frame.set_padding(0, 0, 10, 0) volume_frame.add(volume_button) tab_1_box.pack_start(volume_frame, False, False) # Add entry widget. entry_box = gtk.HBox(spacing=10) text_entry = dtk.ui.entry.TextEntry() text_entry.set_size(100, 22) input_entry = InputEntry() input_entry.entry.place_holder = "哈哈中" input_entry.set_size(100, 22) shortcust_entry = ShortcutKeyEntry() shortcust_entry.set_size(100, 22) password_entry = PasswordEntry() password_entry.set_size(100, 22) combo_box = ComboBox([("测试测试测试%d" % i, i) for i in range(10)], fixed_width=100) spin_box = SpinBox(3000, 0, 5000, 100) # mac_entry = MACEntry() mac_entry = IPV4Entry() mac_entry.connect("changed", print_address)
def __init__(self, module_frame): ''' init docs ''' gtk.VBox.__init__(self) self.module_frame = module_frame self.my_bluetooth = MyBluetooth(self.__on_adapter_removed, self.__on_default_adapter_changed, self.__device_found) self.periodic_timer = None self.is_discoverable = False self.is_searching = False ''' enable open ''' if self.my_bluetooth.adapter: self.my_bluetooth.adapter.connect("property-changed", self.__on_property_changed) if self.my_bluetooth.adapter.get_powered(): self.title_align, self.title_label = self.__setup_title_align( app_theme.get_pixbuf("bluetooth/enable_open.png"), _("Bluetooth")) self.title_label.set_sensitive(True) else: self.title_align, self.title_label = self.__setup_title_align( app_theme.get_pixbuf("bluetooth/enable_open_disable.png"), _("Bluetooth")) else: self.title_align, self.title_label = self.__setup_title_align( app_theme.get_pixbuf("bluetooth/enable_open_disable.png"), _("Bluetooth")) self.title_label.set_sensitive(False) self.enable_align = self.__setup_align() self.enable_box = gtk.HBox(spacing=WIDGET_SPACING) self.enable_open_label = self.__setup_label(_("Enable bluetooth")) if self.my_bluetooth.adapter: self.my_bluetooth.adapter.set_powered( permanent_settings.get_powered()) self.enable_open_label.set_sensitive( self.my_bluetooth.adapter.get_powered()) else: self.enable_open_label.set_sensitive(False) self.enable_open_toggle_align = self.__setup_align(padding_top=4, padding_left=158) self.enable_open_toggle = self.__setup_toggle() if self.my_bluetooth.adapter: self.enable_open_toggle.set_active( self.my_bluetooth.adapter.get_powered()) self.enable_open_toggle.connect("toggled", self.__toggled, "enable_open") self.enable_open_toggle_align.add(self.enable_open_toggle) self.__widget_pack_start( self.enable_box, [self.enable_open_label, self.enable_open_toggle_align]) self.enable_align.add(self.enable_box) ''' display ''' self.display_align = self.__setup_align() self.display_box = gtk.HBox(spacing=WIDGET_SPACING) self.display_device_label = self.__setup_label(_("Device name")) if self.my_bluetooth.adapter: self.display_device_label.set_sensitive( self.my_bluetooth.adapter.get_powered()) else: self.display_device_label.set_sensitive(False) self.display_device_entry = InputEntry() if self.my_bluetooth.adapter: self.display_device_entry.set_text( self.my_bluetooth.adapter.get_name()) self.display_device_entry.set_sensitive( self.my_bluetooth.adapter.get_powered()) else: self.display_device_entry.set_sensitive(False) self.display_device_entry.set_size(HSCALEBAR_WIDTH, WIDGET_HEIGHT) self.display_device_entry.entry.connect("changed", self.__display_device_changed) self.__widget_pack_start( self.display_box, [self.display_device_label, self.display_device_entry]) self.display_align.add(self.display_box) ''' enable searchable ''' self.search_align = self.__setup_align() self.search_box = gtk.HBox(spacing=WIDGET_SPACING) self.search_label = self.__setup_label(_("Discoverable")) if self.my_bluetooth.adapter: self.search_label.set_sensitive( self.my_bluetooth.adapter.get_powered()) else: self.search_label.set_sensitive(False) self.search_timeout_align = self.__setup_align(padding_top=0, padding_left=0) self.search_timeout_label = self.__setup_label("", width=110, align=ALIGN_START) self.search_timeout_align.add(self.search_timeout_label) self.search_toggle_align = self.__setup_align(padding_top=4, padding_left=18) self.search_toggle = self.__setup_toggle() if self.my_bluetooth.adapter: self.search_toggle.set_active( self.my_bluetooth.adapter.get_discoverable()) self.search_toggle.connect("toggled", self.__toggled, "search") self.search_toggle_align.add(self.search_toggle) self.__widget_pack_start(self.search_box, [ self.search_label, self.search_timeout_align, self.search_toggle_align ]) self.search_align.add(self.search_box) ''' device iconview ''' self.device_align = self.__setup_align() self.device_iconview = DeviceIconView() self.device_iconview.set_size_request(690, 228) self.device_align.add(self.device_iconview) ''' operation ''' self.oper_align = self.__setup_align() self.oper_box = gtk.HBox(spacing=WIDGET_SPACING) self.notice_label = Label("", text_x_align=ALIGN_START, label_width=610) self.search_button = Button(_("Search")) if self.my_bluetooth.adapter: self.search_button.set_sensitive( self.my_bluetooth.adapter.get_powered()) else: self.search_button.set_sensitive(False) self.search_button.connect("clicked", self.__on_search) self.__widget_pack_start(self.oper_box, [ self.notice_label, self.search_button, ]) self.oper_align.add(self.oper_box) ''' this->gtk.VBox pack_start ''' self.__widget_pack_start(self, [ self.title_align, self.enable_align, self.display_align, self.search_align, self.device_align, self.oper_align ]) if self.my_bluetooth.adapter == None: self.set_sensitive(False) self.connect("expose-event", self.__expose) if self.my_bluetooth.adapter and self.my_bluetooth.adapter.get_powered( ): self.__get_devices()
def __init__(self, module_infos, switch_page, click_module_item, backward_cb=None, forward_cb=None, search_cb=None): ''' init docs ''' # Init. gtk.Alignment.__init__(self) self.module_infos = module_infos self.set(0.5, 0.5, 1, 1) self.set_padding(0, 0, 0, 0) self.set_size_request(-1, 32) # Init action box. self.main_box = gtk.HBox() # Init action button. self.backward_align = gtk.Alignment() self.backward_align.set(0, 0, 0, 0) self.backward_align.set_padding(8, 5, 10, 0) self.backward_button = ImageButton( app_theme.get_pixbuf("action_button/backward_normal.png"), app_theme.get_pixbuf("action_button/backward_hover.png"), app_theme.get_pixbuf("action_button/backward_press.png"), insensitive_dpixbuf=app_theme.get_pixbuf( "action_button/backward_normal.png")) self.backward_cb = backward_cb self.backward_button.connect("clicked", self.__backward_clicked) self.backward_align.add(self.backward_button) self.forward_align = gtk.Alignment() self.forward_align.set(0, 0, 0, 0) self.forward_align.set_padding(8, 5, 10, 0) self.forward_button = ImageButton( app_theme.get_pixbuf("action_button/forward_normal.png"), app_theme.get_pixbuf("action_button/forward_hover.png"), app_theme.get_pixbuf("action_button/forward_press.png"), insensitive_dpixbuf=app_theme.get_pixbuf( "action_button/forward_normal.png")) self.forward_cb = forward_cb self.forward_button.connect("clicked", self.__forward_clicked) self.forward_align.add(self.forward_button) self.action_box = gtk.HBox() self.action_align = gtk.Alignment() self.action_align.set(0.5, 0, 0, 0) self.action_align.set_padding(0, 0, 5, 5) self.bread_align = gtk.Alignment() self.bread_align.set(0, 0.5, 1, 0) self.bread_align.set_padding(0, 0, 4, 4) # Init navigate bar. self.navigate_bar = gtk.HBox() self.bread = Bread(crumb=[ (_("System Settings"), map( lambda module_info: ModuleMenuItem(module_info, click_module_item), list(itertools.chain(*module_infos)))), ], show_left_right_box=False) #self.bread.set_size(-1, 24) self.bread.connect("item_clicked", switch_page) # Init search entry. self.search_button = ImageButton( app_theme.get_pixbuf("entry/search_normal.png"), app_theme.get_pixbuf("entry/search_hover.png"), app_theme.get_pixbuf("entry/search_press.png"), ) self.search_cb = search_cb self.search_entry = InputEntry(action_button=self.search_button) self.search_entry.set_size(150, 24) self.search_entry.entry.connect("changed", self.__search_changed) self.search_entry.entry.connect("press-return", self.__search_press_enter) self.search_align = gtk.Alignment() self.search_align.set(0.5, 0.5, 0, 0) self.search_align.set_padding(5, 0, 5, 10) # Connect widgets. self.action_align.add(self.action_box) self.bread_align.add(self.bread) self.search_align.add(self.search_entry) self.action_box.pack_start(self.backward_align) self.action_box.pack_start(self.forward_align) self.navigate_bar.pack_start(self.bread_align, True, True) self.main_box.pack_start(self.action_align, False, False) self.main_box.pack_start(self.navigate_bar, True, True) self.main_box.pack_start(self.search_align, False, False) self.add(self.main_box)
def __init__(self, filename=""): ''' init share @param filename: the file to share ''' self.upload_image = filename self.thumb_width = 188 self.thumb_height = 168 self.MAX_CHAR = 140 #self.__text_frame_color = (0.76, 0.76, 0.76) self.__win_width = 602 open(COOKIE_FILE,'wb').close() self.window = DialogBox(_("Share to social networks"), close_callback=gtk.main_quit) self.window.set_keep_above(True) self.window.set_size_request(self.__win_width+20, 288) self.window.set_resizable(False) #self.window.titlebar.connect("expose-event", self.__expose_top_and_bottome) #self.window.button_box.connect("expose-event", self.__expose_top_and_bottome) # create slider self.slider = HSlider() self.slider_list = [] self.share_box = gtk.VBox(False) # first page, input context self.web_box = gtk.VBox(False, 10) # second page, login self.result_box = gtk.VBox(False, 10) # third page, share result share_align = gtk.Alignment() share_align.set(0.5, 0.5, 0, 0) share_align.add(self.share_box) share_align.connect("expose-event", self.__slider_expose) # go back button web_left_button = ImageButton( app_theme.get_pixbuf("share/back_normal.png"), app_theme.get_pixbuf("share/back_hover.png"), app_theme.get_pixbuf("share/back_press.png")) web_left_button.connect("clicked", lambda w: self.set_slide_index(0)) web_left_button.set_can_focus(False) utils.set_clickable_cursor(web_left_button) # show url entry self.web_url_entry = InputEntry() self.web_url_entry.set_editable(False) self.web_url_entry.set_size(555, 20) self.web_url_entry.entry.right_menu_visible_flag = False # alig url entry web_navigate_vbox = gtk.VBox(False) web_navigate_vbox.pack_start(self.web_url_entry) web_navigate_t_align = gtk.Alignment() web_navigate_t_align.set(0.0, 0.5, 0, 0) web_navigate_t_align.add(web_navigate_vbox) # pack back button and url entry web_navigate_box = gtk.HBox(False, 7) web_navigate_box.pack_start(web_left_button, False, False) web_navigate_box.pack_start(web_navigate_t_align) web_navigate_align = gtk.Alignment() web_navigate_align.set(0.5, 0.5, 0, 0) web_navigate_align.set_padding(4, 0, 11, 13) web_navigate_align.add(web_navigate_box) # create a webkit self.web_view = WebView(COOKIE_FILE) self.web_view.connect("notify::load-status", self.web_view_load_status) self.web_view.connect("load-error", self.web_view_load_error) self.web_scrolled_window = ScrolledWindow() self.web_scrolled_window.add(self.web_view) self.web_scrolled_window.set_size_request(590, 228) self.web_box.pack_start(web_navigate_align, False, False) self.web_box.pack_start(self.web_scrolled_window) #self.web_box.set_size_request(-1, 258) web_align = gtk.Alignment() web_align.set(0.5, 0.0, 0, 1) web_align.add(self.web_box) web_align.connect("expose-event", self.__slider_expose) res_align = gtk.Alignment() res_align.set(0.5, 0.5, 0, 0) res_align.add(self.result_box) res_align.connect("expose-event", self.__slider_expose) self.slider.set_to_page(share_align) self.slider_list.append(share_align) self.slider_list.append(web_align) self.slider_list.append(res_align) self.__weibo_list = [] self.sina = weibo.Sina(self.web_view) self.qq = weibo.Tencent(self.web_view) self.__weibo_list.append(self.sina) self.__weibo_list.append(self.qq) if default_locale != 'zh_CN': self.twitter = weibo.Twitter(self.web_view) #self.__weibo_list.append(self.twitter) self.__current_weibo = None self.weibo_name_l18n = { 'Sina': _("Sina"), 'Tencent': _("Tencent"), 'Twitter': _("Twitter"), } self.window.body_box.pack_start(self.slider, True, True) self.init_share_box()
def __setup_entry(self, content=""): entry = InputEntry(content) entry.set_size(215, WIDGET_HEIGHT) return entry
def __init__(self, connection, set_button_callback, settings_obj=None): gtk.VBox.__init__(self) self.tab_name = _("Broadband") self.connection = connection self.set_button = set_button_callback # 新增settings_obj变量,用于访问shared_methods.Settings对象 self.settings_obj = settings_obj # Init widgets self.table = gtk.Table(12, 4, False) #self.label_basic = Label(_("Basic"), text_size = TITLE_FONT_SIZE) self.label_basic = TitleBar(None, _("Basic")) self.label_number = Label(_("Code:"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.label_username = Label(_("Username:"******"Password:"******"Show password"), padding_x=0) self.button_to_region = Button(_("Regions setting")) #self.table = gtk.Table(6, 4, False) self.label_advanced = TitleBar(None,_("Advanced")) self.label_apn = Label(_("APN:"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.label_network = Label(_("Network ID:"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.label_type = Label(_("Type:"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.label_pin = Label(_("PIN:"), text_size=CONTENT_FONT_SIZE, enable_select=False, enable_double_click=False) self.apn = InputEntry() self.network_id = InputEntry() self.network_type = ComboBox([("Any", None), ("3G", 0), ("2G", 1), ("Prefer 3G", 2), ("Prefer 2G", 3)], fixed_width=self.ENTRY_WIDTH) self.roam_check = CheckButton(_("Allow roaming if home network is not available"), padding_x=0) self.pin = InputEntry() # Connect signals self.number.entry.connect("changed", self.save_settings_by, "number") self.username.entry.connect("changed", self.save_settings_by, "username") self.password.entry.connect("changed", self.save_settings_by, "password") self.apn.entry.connect("changed", self.save_settings_by, "apn") self.network_id.entry.connect("changed", self.save_settings_by, "network_id") self.network_type.connect("item-selected", self.network_type_selected) self.password_show.connect("toggled", self.password_show_toggled) self.roam_check.connect("toggled", self.roam_check_toggled) table_align = gtk.Alignment(0, 0, 0, 0) table_align.add(self.table) self.pack_start(table_align) # wrap with alignment # Refesh self.refresh()
def __init__(self, connection, module_frame, set_button_callback=None, settings_obj=None): gtk.VBox.__init__(self) self.connection = connection self.tab_name = _("PPTP") self.module_frame = module_frame self.set_button = set_button_callback # 新增settings_obj变量,用于访问shared_methods.Settings对象 self.settings_obj = settings_obj self.vpn_setting = self.connection.get_setting("vpn") # UI pptp_table = gtk.Table(7, 4, False) name_label = Label(_("Connection Name:"), enable_select=False, enable_double_click=False) name_label.set_can_focus(False) gateway_label = Label(_("Gateway:"), enable_select=False, enable_double_click=False) gateway_label.set_can_focus(False) user_label = Label(_("Username:"******"Password:"******"NT Domain:"), enable_select=False, enable_double_click=False) nt_domain_label.set_can_focus(False) # Radio Button self.pptp_radio = RadioButton(_("PPTP")) self.l2tp_radio = RadioButton(_("L2TP")) radio_box = gtk.HBox(spacing=30) radio_box.pack_start(self.pptp_radio, True, True) radio_box.pack_start(self.l2tp_radio, True, True) #pack labels pptp_table.attach(style.wrap_with_align(radio_box, align="left"), 2, 4, 0, 1) pptp_table.attach( style.wrap_with_align(name_label, width=self.LEFT_PADDING), 0, 2, 1, 2) pptp_table.attach( style.wrap_with_align(gateway_label, width=self.LEFT_PADDING), 0, 2, 2, 3) pptp_table.attach( style.wrap_with_align(user_label, width=self.LEFT_PADDING), 0, 2, 3, 4) pptp_table.attach( style.wrap_with_align(password_label, width=self.LEFT_PADDING), 0, 2, 4, 5) #pptp_table.attach(style.wrap_with_align(nt_domain_label), 0, 2, 5, 6) # entries self.name_entry = InputEntry() self.name_entry.set_size(self.ENTRY_WIDTH, 22) self.gateway_entry = InputEntry() self.gateway_entry.set_size(self.ENTRY_WIDTH, 22) self.user_entry = InputEntry() self.user_entry.set_size(self.ENTRY_WIDTH, 22) # FIXME should change to new_entry PasswordEntry self.password_entry = PasswordEntry() self.password_entry.set_size(self.ENTRY_WIDTH, 22) self.password_show = CheckButton(_("Show Password"), padding_x=0) self.password_show.set_active(False) self.password_show.connect("toggled", self.show_password) self.nt_domain_entry = InputEntry() self.nt_domain_entry.set_size(self.ENTRY_WIDTH, 22) #pack entries pptp_table.attach(style.wrap_with_align(self.name_entry, align="left"), 2, 4, 1, 2) pptp_table.attach( style.wrap_with_align(self.gateway_entry, align="left"), 2, 4, 2, 3) pptp_table.attach(style.wrap_with_align(self.user_entry, align="left"), 2, 4, 3, 4) pptp_table.attach( style.wrap_with_align(self.password_entry, align="left"), 2, 4, 4, 5) pptp_table.attach( style.wrap_with_align(self.password_show, align="left"), 2, 4, 5, 6) #pptp_table.attach(style.wrap_with_align(self.nt_domain_entry), 2, 4, 5, 6) # Advance setting button #advanced_button = Button(_("Advanced Setting")) #advanced_button.connect("clicked", self.advanced_button_click) #pptp_table.attach(style.wrap_with_align(advanced_button), 3, 4, 6, 7) self.service_type = self.vpn_setting.service_type.split(".")[-1] if self.service_type == "l2tp": self.l2tp_radio.set_active(True) else: self.pptp_radio.set_active(True) self.pptp_radio.connect("toggled", self.radio_toggled, "pptp") self.l2tp_radio.connect("toggled", self.radio_toggled, "l2tp") # set signals #align = style.set_box_with_align(pptp_table, "text") table_align = gtk.Alignment(0, 0, 0, 0) table_align.add(pptp_table) #style.set_table_items(pptp_table, "entry") style.draw_background_color(self) style.set_table(pptp_table) self.add(table_align) self.show_all() self.refresh() self.name_entry.entry.connect("changed", self.entry_changed, "name") self.gateway_entry.entry.connect("changed", self.entry_changed, "gateway") self.user_entry.entry.connect("changed", self.entry_changed, "user") self.password_entry.entry.connect("changed", self.entry_changed, "password") self.nt_domain_entry.entry.connect("changed", self.entry_changed, "domain")
def __init__(self, connection, set_button_cb, settings_obj=None): gtk.VBox.__init__(self) self.tab_name = _("Wireless") self.connection = connection self.set_button = set_button_cb # 新增settings_obj变量,用于访问shared_methods.Settings对象 self.settings_obj = settings_obj self.wireless = self.connection.get_setting("802-11-wireless") ### UI self.ssid_label = Label(_("SSID:"), enable_select=False, enable_double_click=False) self.ssid_entry = InputEntry() self.ssid_entry.set_size(self.ENTRY_WIDTH, 22) self.mode_label = Label(_("Mode:"), enable_select=False, enable_double_click=False) self.mode_combo = ComboBox([(_("Infrastructure"), "infrastructure"), (_("Ad-hoc"), "adhoc")], fixed_width=130) # TODO need to put this section to personal wifi self.band_label = Label(_("Band:"), enable_select=False, enable_double_click=False) self.band_combo = ComboBox([(_("Automatic"), None), ("a (5 GHZ)", "a"), ("b/g (2.4)", "bg")], fixed_width=self.ENTRY_WIDTH) self.channel_label = Label(_("Channel:"), enable_select=False, enable_double_click=False) self.channel_spin = SpinBox(0, 0, 1500, 1, self.ENTRY_WIDTH) # BSSID self.bssid_label = Label(_("BSSID:"), enable_select=False, enable_double_click=False) self.bssid_entry = MACEntry() self.mac_address_label = Label(_("Device Mac Address:"), enable_select=False, enable_double_click=False) self.mac_entry = MACEntry() self.clone_addr_label = Label(_("Cloned Mac Address:"), enable_select=False, enable_double_click=False) self.clone_entry = MACEntry() self.mtu_label = Label(_("MTU:"), enable_select=False, enable_double_click=False) self.mtu_spin = SpinBox(0, 0, 1500, 1, 130) self.table = gtk.Table(8, 2, False) """ wrap with alignment """ widget_list = [ "ssid_label", "ssid_entry", "mode_label", "mode_combo", "band_label", "band_combo", "channel_label", "channel_spin", "bssid_label", "bssid_entry", "mac_address_label", "mac_entry", "clone_addr_label", "clone_entry", "mtu_label", "mtu_spin" ] for widget in widget_list: item = getattr(self, widget) if widget.endswith("label"): item.set_can_focus(False) align = style.wrap_with_align(item, width=210) else: align = style.wrap_with_align(item, align="left") setattr(self, widget + "_align", align) #TODO UI change style.draw_background_color(self) #align = style.set_box_with_align(self.table, 'text') style.set_table(self.table) self.section = SettingSection(_("Default Settings"), always_show=False, revert=True, label_right=True, has_seperator=False) self.pack_start(self.section, False, False) self.section.toggle_off = self.use_default_setting self.section.toggle_on = self.use_user_setting self.section.load([self.table]) #self.pack_start(self.table, False, False) #self.table.set_size_request(340, 227) #self.ssid_entry.set_size_request(130, 22) self.bssid_entry.set_size_request(130, 22) self.mac_entry.set_size_request(130, 22) self.clone_entry.set_size_request(130, 22) self.reset() #self.mode_combo.connect("item-selected", self.mode_combo_selected) self.band_combo.connect("item-selected", self.band_combo_selected) self.mtu_spin.connect("value-changed", self.spin_value_changed, "mtu") self.mtu_spin.value_entry.connect("changed", self.spin_user_set) self.channel_spin.connect("value-changed", self.spin_value_changed, "channel") self.ssid_entry.entry.connect("changed", self.entry_changed, "ssid") self.bssid_entry.connect("changed", self.entry_changed, "bssid") self.mac_entry.connect("changed", self.entry_changed, "mac_address") self.clone_entry.connect("changed", self.entry_changed, "cloned_mac_address")
if self.redraw_request_callback: self.redraw_request_callback(self) def unselect(self): self.is_select = False if self.redraw_request_callback: self.redraw_request_callback(self) def select(self): self.is_select = True if self.redraw_request_callback: self.redraw_request_callback(self) def button_press(self, column, offset_x, offset_y): global_event.emit("switch-to-detail-page", self.text) gobject.type_register(TextItem) search_entry = InputEntry(action_button=ImageButton( app_theme.get_pixbuf("entry/search_normal.png"), app_theme.get_pixbuf("entry/search_hover.png"), app_theme.get_pixbuf("entry/search_press.png"), )) search_entry.set_size(140, 24) completion_grab_window = CompletionGrabWindow() completion_window = CompletionWindow(300, 200)