def __init__(self, name, text_size = TITLE_FONT_SIZE, always_show = False, toggle_callback=None, label_right=False): gtk.HBox.__init__(self) self.set_size_request(-1, 30) self.label = Label(name, text_size=text_size, text_color=app_theme.get_color("globalTitleForeground"), enable_select=False, enable_double_click=False) if label_right: self.label_box = style.wrap_with_align(self.label, width=210) else: self.label_box = style.wrap_with_align(self.label, align="left", width=210) self.label_box.set_size_request(210, 30) self.pack_start(self.label_box, False, False) if not always_show: self.switch = SwitchButton( False, inactive_disable_dpixbuf = app_theme.get_pixbuf("toggle_button/inactive_normal.png"), active_disable_dpixbuf = app_theme.get_pixbuf("toggle_button/active_disable.png")) align = style.wrap_with_align(self.switch, align="left") self.pack_start(align, False, False) self.switch.connect("toggled", toggle_callback) align.set_padding(0, 0, 15, 0)
def __init__(self, name, text_size=TITLE_FONT_SIZE, always_show=False, toggle_callback=None, label_right=False): gtk.HBox.__init__(self) self.set_size_request(-1, 30) self.label = Label( name, text_size=text_size, text_color=app_theme.get_color("globalTitleForeground"), enable_select=False, enable_double_click=False) if label_right: self.label_box = style.wrap_with_align(self.label, width=210) else: self.label_box = style.wrap_with_align(self.label, align="left", width=210) self.label_box.set_size_request(210, 30) self.pack_start(self.label_box, False, False) if not always_show: self.switch = SwitchButton( False, inactive_disable_dpixbuf=app_theme.get_pixbuf( "toggle_button/inactive_normal.png"), active_disable_dpixbuf=app_theme.get_pixbuf( "toggle_button/active_disable.png")) align = style.wrap_with_align(self.switch, align="left") self.pack_start(align, False, False) self.switch.connect("toggled", toggle_callback) align.set_padding(0, 0, 15, 0)
def __init__(self, connection, delete_cb, set_button_cb=None): TreeItem.__init__(self) #self.title = title self.connection = connection #self.click = click_cb self.delete_connection = delete_cb self.set_button = set_button_cb self.entry = None self.entry_buffer = EntryBuffer(connection.get_setting("connection").id) self.entry_buffer.set_property('cursor-visible', False) self.entry_buffer.connect("changed", self.entry_buffer_changed) self.entry_buffer.connect("insert-pos-changed", self.entry_buffer_changed) self.entry_buffer.connect("selection-pos-changed", self.entry_buffer_changed) self.child_items = [] self.height = 30 self.ENTRY_COLUMN = [1] self.is_double_click = False self.check_select = False self.is_hover = False self.delete_hover = False self.connection_active = False ''' Pixbuf ''' self.check_pixbuf_active = app_theme.get_pixbuf("network/check_box-1.png") self.delete_pixbuf_out = app_theme.get_pixbuf("network/delete-3.png") self.delete_pixbuf_prelight = app_theme.get_pixbuf("network/delete.png") self.delete_pixbuf_active = app_theme.get_pixbuf("network/delete-1.png")
def __init__(self): SwitchButton.__init__(self, False, inactive_disable_dpixbuf=app_theme.get_pixbuf( "toggle_button/inactive_normal.png"), active_disable_dpixbuf=app_theme.get_pixbuf( "toggle_button/active_disable.png"))
def __init__(self, name, add_setting_callback): TreeItem.__init__(self) self.name = name self.add_setting = add_setting_callback ''' Pixbuf ''' self.add_pixbuf_out = app_theme.get_pixbuf("network/add-1.png") self.add_pixbuf_active = app_theme.get_pixbuf("network/add.png")
def __init__(self, font_size=CONTENT_FONT_SIZE): TreeItem.__init__(self) self.wifi = app_theme.get_pixbuf("network/wifi_device.png") self.left = app_theme.get_pixbuf("network/left.png") self.right = app_theme.get_pixbuf("network/right.png") self.devices = net_manager.device_manager.wireless_devices self.index = 1
def find_match_flag(self, country): formated_string = country.lower().replace(" ", "_").replace(",", '') try: return app_theme.get_pixbuf("network/flags/" + "flag_" + formated_string + ".png") except: return None
def init_ui(self): self.wire = Section(app_theme.get_pixbuf("network/cable.png"), _("Wired")) self.wireless = Section(app_theme.get_pixbuf("network/wifi.png"), _("Wireless")) self.mobile = Section(app_theme.get_pixbuf("network/3g.png"), _("Mobile Network")) # vpn self.vpn = Section(app_theme.get_pixbuf("network/vpn.png"), _("VPN Network")) self.dsl = Section(app_theme.get_pixbuf("network/dsl.png"), _("DSL")) self.ssid_list = [] self.tree_box = gtk.VBox(spacing=0) self.button_more = SelectButton(_("Advanced..."), font_size=10, ali_padding=5) self.button_more.set_size_request(-1, 25) #self.pack_start(self.button_more, False, False) self.ap_tree = TreeView(mask_bound_height=0) self.ap_tree.set_expand_column(0) self.vpn_list = ConList() self.dsl_list = DSLConList() self.wire_box = self.section_box([self.wire]) self.wireless_box = self.section_box([self.wireless, self.tree_box]) self.mobile_box = self.section_box([self.mobile]) self.vpn_box = self.section_box([self.vpn, self.vpn_list]) self.dsl_box = self.section_box([self.dsl, self.dsl_list]) self.wire_state = False self.wireless_state = False self.mobile_state = False self.vpn_state = False self.dsl_state = False self.device_tree = None self.pack_start(self.wire_box, False, False) self.pack_start(self.wireless_box, False, False) self.pack_start(self.mobile_box, False, False) self.pack_start(self.vpn_box, False, False) self.pack_start(self.dsl_box, False, False) self.pack_start(self.button_more, False, False)
def __init__(self): Section.__init__(self) MobileDevice.__init__(self) # init values self.mobile = Contain(app_theme.get_pixbuf("network/3g.png"), _("Mobile Network"), lambda w:w) self.label = Label(_("Mobile Configuration"), LABEL_COLOR, underline=True, enable_select=False, enable_double_click=False) self.load(self.mobile, [])
def __init__(self): Section.__init__(self) self.dsl = Contain(app_theme.get_pixbuf("network/dsl.png"), _("DSL"), lambda w: w) self.label = Label(_("Create a DSL connection"), LABEL_COLOR, underline=True, enable_select=False, enable_double_click=False) self.load(self.dsl, [self.label]) self.active_connection = None
def __init__(self, default_width=350, default_height=160, confirm_callback=None, cancel_callback=None): ''' Initialize InputDialog class. @param title: Input dialog title. @param init_text: Initialize input text. @param default_width: Width of dialog, default is 330 pixel. @param default_height: Height of dialog, default is 330 pixel. @param confirm_callback: Callback when user click confirm button, this callback accept one argument that return by user input text. @param cancel_callback: Callback when user click cancel button, this callback not need argument. ''' # Init. DialogBox.__init__(self, _("Autostart app"), default_width, default_height, DIALOG_MASK_SINGLE_PAGE) self.confirm_callback = confirm_callback self.cancel_callback = cancel_callback self.on_click = None self.confirm_button = Button(_("OK")) self.cancel_button = Button(_("Cancel")) self.confirm_button.connect("clicked", lambda w: self.click_confirm_button()) self.cancel_button.connect("clicked", lambda w: self.click_cancel_button()) self.connect( "destroy", self._close_callback ) #self.close_callback is None at this moment, so we use _close_callback # get system pixbuf icon_theme = gtk.IconTheme() icon_theme.set_custom_theme("Deepin") icon_info = None if icon_theme: icon_info = icon_theme.lookup_icon("folder-open", 16, gtk.ICON_LOOKUP_NO_SVG) self.icon_pixbuf = None if icon_info: self.icon_pixbuf = DynamicPixbuf(icon_info.get_filename()) else: self.icon_pixbuf = app_theme.get_pixbuf("navigate/none-small.png") table = self.add_new_box() self.pack(self.body_box, [table]) self.right_button_box.set_buttons( [self.cancel_button, self.confirm_button]) self.connect("show", self.focus_input)
def __init__(self): Section.__init__(self) MobileDevice.__init__(self) # init values self.mobile = Contain(app_theme.get_pixbuf("network/3g.png"), _("Mobile Network"), lambda w: w) self.label = Label(_("Mobile Configuration"), LABEL_COLOR, underline=True, enable_select=False, enable_double_click=False) self.load(self.mobile, [])
def __init__(self): Section.__init__(self) #init self.vpn = Contain(app_theme.get_pixbuf("network/vpn.png"), _("VPN Network"), lambda w:w) self.label = Label(_("Create a VPN connection"), LABEL_COLOR, underline=True, enable_select=False, enable_double_click=False) self.load(self.vpn, [self.label]) self.no_auto_connect = False self.no_vpn_connecting = False self.this_setting = None self.vpn_path = None
def __init__(self, send_to_crumb_cb): gtk.VBox.__init__(self, 0) cont = Contain(app_theme.get_pixbuf("network/wifi.png"), _("Hotspot"), self.toggle_cb) self.pack_start(cont, False, False) self.settings = None self.send_to_crumb_cb = send_to_crumb_cb self.align = gtk.Alignment(0, 0, 1, 1) self.align.set_padding(0, 0, PADDING, 22) self.hotspot_box = HotspotBox(self.active_connection) self.align.add(self.hotspot_box) self.active_this_adhoc = False if self.is_adhoc_active(): cont.set_active(True) self.hotspot_box.set_net_state(2) self.active_this_adhoc = True self.__init_state()
def __init__(self, default_width=350, default_height=160, confirm_callback=None, cancel_callback=None): ''' Initialize InputDialog class. @param title: Input dialog title. @param init_text: Initialize input text. @param default_width: Width of dialog, default is 330 pixel. @param default_height: Height of dialog, default is 330 pixel. @param confirm_callback: Callback when user click confirm button, this callback accept one argument that return by user input text. @param cancel_callback: Callback when user click cancel button, this callback not need argument. ''' # Init. DialogBox.__init__(self, _("Autostart app"), default_width, default_height, DIALOG_MASK_SINGLE_PAGE) self.confirm_callback = confirm_callback self.cancel_callback = cancel_callback self.on_click = None self.confirm_button = Button(_("OK")) self.cancel_button = Button(_("Cancel")) self.confirm_button.connect("clicked", lambda w: self.click_confirm_button()) self.cancel_button.connect("clicked", lambda w: self.click_cancel_button()) self.connect("destroy", self._close_callback) #self.close_callback is None at this moment, so we use _close_callback # get system pixbuf icon_theme = gtk.IconTheme() icon_theme.set_custom_theme("Deepin") icon_info = None if icon_theme: icon_info = icon_theme.lookup_icon("folder-open", 16, gtk.ICON_LOOKUP_NO_SVG) self.icon_pixbuf = None if icon_info: self.icon_pixbuf = DynamicPixbuf(icon_info.get_filename()) else: self.icon_pixbuf = app_theme.get_pixbuf("navigate/none-small.png") table = self.add_new_box() self.pack(self.body_box, [table]) self.right_button_box.set_buttons([self.cancel_button, self.confirm_button]) self.connect("show", self.focus_input)
def __init__(self): Section.__init__(self) #init self.vpn = Contain(app_theme.get_pixbuf("network/vpn.png"), _("VPN Network"), lambda w: w) self.label = Label(_("Create a VPN connection"), LABEL_COLOR, underline=True, enable_select=False, enable_double_click=False) self.load(self.vpn, [self.label]) self.no_auto_connect = False self.no_vpn_connecting = False self.this_setting = None self.vpn_path = None
def __init__(self): Section.__init__(self) WirelessDevice.__init__(self) self.wireless = Contain(app_theme.get_pixbuf("network/wifi.png"), _("Wireless"), lambda w:w) self.label = Label(_("Set up a hidden wireless connection"), LABEL_COLOR, underline=True, enable_select=False, enable_double_click=False) space = gtk.VBox() space.set_size_request(-1, 15) self.load(self.wireless, [space, self.label]) self.content_box.set_spacing(0) self.selected_item = None self.device_tree = None self.focused_device = None self.wireless_devices = None
def __init__(self): Section.__init__(self) WirelessDevice.__init__(self) self.wireless = Contain(app_theme.get_pixbuf("network/wifi.png"), _("Wireless"), lambda w: w) self.label = Label(_("Set up a hidden wireless connection"), LABEL_COLOR, underline=True, enable_select=False, enable_double_click=False) space = gtk.VBox() space.set_size_request(-1, 15) self.load(self.wireless, [space, self.label]) self.content_box.set_spacing(0) self.selected_item = None self.device_tree = None self.focused_device = None self.wireless_devices = None
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 __init__(self, connection=None): gtk.Alignment.__init__(self, 0, 0, 0, 0) ################# self.provider_select = None self.connect('expose-event', self.expose_event) self.prop_dict = {} main_table = gtk.Table(2, 2, False) main_table.set_row_spacing(1, 10) main_table.set_col_spacings(4) self.add(main_table) self.country_tree = TreeView( enable_multiple_select=False, enable_drag_drop=False, ) self.country_tree.set_expand_column(1) self.country_tree.set_size_request(365, 380) self.country_tree.draw_mask = self.draw_mask self.country_tree.connect("button-press-item", self.country_selected) left_box_align = gtk.Alignment(0, 0, 0, 0) left_box_align.set_padding(1, 1, 1, 1) left_box_align.add(self.country_tree) left_box_align.show_all() left_box = gtk.VBox() # wrap title country_title = TitleBar( app_theme.get_pixbuf("network/globe-green.png"), _("Country or Region:"), has_separator=False) left_box.pack_start(country_title, False, False) left_box.pack_start(left_box_align, False, False) self.provider_tree = TreeView( enable_multiple_select=False, enable_drag_drop=False, ) self.provider_tree.set_expand_column(0) self.provider_tree.set_size_request(365, 380) self.provider_tree.draw_mask = self.draw_mask self.provider_tree.connect("button-press-item", self.provider_selected) right_box_align = gtk.Alignment(0, 0, 0, 0) right_box_align.set_padding(1, 1, 1, 1) right_box_align.add(self.provider_tree) right_box = gtk.VBox() # wrap title provider_title = TitleBar(app_theme.get_pixbuf("network/building.png"), _("Provider:"), has_separator=False) right_box.pack_start(provider_title, False, False) right_box.pack_start(right_box_align, False, False) main_left_align = gtk.Alignment(0, 0, 0, 0) main_left_align.set_padding(15, 0, 20, 0) main_left_align.add(left_box) main_table.attach(main_left_align, 0, 1, 0, 1) main_right_align = gtk.Alignment(0, 0, 0, 0) main_right_align.set_padding(15, 0, 0, 20) main_right_align.add(right_box) main_table.attach(main_right_align, 1, 2, 0, 1) hints = _( "Tips:This assistant helps you easily set up a mobile broadband connection to a cellular network." ) left_box_align.connect("expose-event", self.expose_outline) right_box_align.connect("expose-event", self.expose_outline) next_button = Button("Next") next_button.connect("clicked", self.next_button_clicked) self.foot_box = FootBox() self.foot_box.set_buttons([next_button]) self.foot_box.set_tip(hints) main_table.attach(self.foot_box, 0, 2, 1, 2) self.show_all()
def click_radio_button(self, widget): if self.main_button: buttons = self.main_button.button_list else: buttons = self.button_list if not self.switch_lock: for w in buttons: w.switch_lock = True w.set_active(w == self) w.switch_lock = False if __name__ == "__main__": win = gtk.Window(gtk.WINDOW_TOPLEVEL) win.set_title("Container") #win.border_width(2) win.connect("destroy", lambda w: gtk.main_quit()) con = Contain(app_theme.get_pixbuf("network/wired.png"), "有线网络", lambda w: "sfdsf") vbox = gtk.VBox(False) vbox.pack_start(con) win.add(vbox) win.show_all() gtk.main()
self.connect("clicked", self.click_radio_button) def click_radio_button(self, widget): if self.main_button: buttons = self.main_button.button_list else: buttons = self.button_list if not self.switch_lock: for w in buttons: w.switch_lock = True w.set_active(w == self) w.switch_lock = False if __name__=="__main__": win = gtk.Window(gtk.WINDOW_TOPLEVEL) win.set_title("Container") #win.border_width(2) win.connect("destroy", lambda w: gtk.main_quit()) con = Contain(app_theme.get_pixbuf("network/wired.png"), "有线网络", lambda w: "sfdsf") vbox = gtk.VBox(False) vbox.pack_start(con) win.add(vbox) win.show_all() gtk.main()
def __init__(self): SwitchButton.__init__(self, False, inactive_disable_dpixbuf = app_theme.get_pixbuf("toggle_button/inactive_normal.png"), active_disable_dpixbuf = app_theme.get_pixbuf("toggle_button/active_disable.png"))
def __init__(self): gtk.VBox.__init__(self) self.proxy = Contain(app_theme.get_pixbuf("network/proxy.png"), _("Proxy"), self.toggle_cb) self.proxysetting = ProxySettings() self.add(self.proxy)
def __init__(self, ap, setting_object=None, font_size=CONTENT_FONT_SIZE): TreeItem.__init__(self) self.ap = ap self.ssid = ap.get_ssid() self.security = ap.get_flags() self.strength = ap.get_strength() self.is_double_click = False self.active = False ''' Pixbufs ''' self.loading_pixbuf = app_theme.get_pixbuf("network/loading.png") self.check_pixbuf = app_theme.get_pixbuf("network/check_box-2.png") self.check_out_pixbuf = app_theme.get_pixbuf( "network/check_box_out.png") #self.lock_pixbuf = app_theme.get_pixbuf("lock/lock.png") if self.security: self.strength_0 = app_theme.get_pixbuf("network/secured-0.png") self.strength_1 = app_theme.get_pixbuf("network/secured-1.png") self.strength_2 = app_theme.get_pixbuf("network/secured-2.png") self.strength_3 = app_theme.get_pixbuf("network/secured-3.png") else: self.strength_0 = app_theme.get_pixbuf("network/Wifi_0.png") self.strength_1 = app_theme.get_pixbuf("network/Wifi_1.png") self.strength_2 = app_theme.get_pixbuf("network/Wifi_2.png") self.strength_3 = app_theme.get_pixbuf("network/Wifi_3.png") self.jumpto_pixbuf = app_theme.get_pixbuf("network/jump_to.png") self.right_padding = 0
def __init__(self): Section.__init__(self) self.wire = Contain(app_theme.get_pixbuf("network/cable.png"), _("Wired"), lambda w: w) self.load(self.wire, [])
def __init__(self): Section.__init__(self) self.wire = Contain(app_theme.get_pixbuf("network/cable.png"), _("Wired"), lambda w:w) self.load(self.wire, [])
def __init__(self, connection=None): gtk.Alignment.__init__(self, 0, 0, 0, 0) ################# self.provider_select = None self.connect('expose-event', self.expose_event) self.prop_dict = {} main_table = gtk.Table(2, 2, False) main_table.set_row_spacing(1, 10) main_table.set_col_spacings(4) self.add(main_table) self.country_tree = TreeView(enable_multiple_select=False, enable_drag_drop=False, ) self.country_tree.set_expand_column(1) self.country_tree.set_size_request(365, 380) self.country_tree.draw_mask = self.draw_mask self.country_tree.connect("button-press-item", self.country_selected) left_box_align = gtk.Alignment(0, 0, 0, 0) left_box_align.set_padding(1,1,1,1) left_box_align.add(self.country_tree) left_box_align.show_all() left_box = gtk.VBox() # wrap title country_title = TitleBar(app_theme.get_pixbuf("network/globe-green.png"), _("Country or Region:"), has_separator=False) left_box.pack_start(country_title, False, False) left_box.pack_start(left_box_align, False, False) self.provider_tree = TreeView(enable_multiple_select=False, enable_drag_drop=False, ) self.provider_tree.set_expand_column(0) self.provider_tree.set_size_request(365, 380) self.provider_tree.draw_mask = self.draw_mask self.provider_tree.connect("button-press-item", self.provider_selected) right_box_align = gtk.Alignment(0, 0, 0, 0) right_box_align.set_padding(1,1,1,1) right_box_align.add(self.provider_tree) right_box = gtk.VBox() # wrap title provider_title = TitleBar(app_theme.get_pixbuf("network/building.png"), _("Provider:"), has_separator=False) right_box.pack_start(provider_title, False, False) right_box.pack_start(right_box_align, False, False) main_left_align = gtk.Alignment(0, 0, 0, 0) main_left_align.set_padding(15, 0, 20, 0) main_left_align.add(left_box) main_table.attach(main_left_align, 0, 1, 0, 1) main_right_align = gtk.Alignment(0, 0, 0, 0) main_right_align.set_padding(15, 0, 0, 20) main_right_align.add(right_box) main_table.attach(main_right_align, 1, 2, 0, 1) hints = _("Tips:This assistant helps you easily set up a mobile broadband connection to a cellular network.") left_box_align.connect("expose-event", self.expose_outline) right_box_align.connect("expose-event", self.expose_outline) next_button = Button("Next") next_button.connect("clicked", self.next_button_clicked) self.foot_box = FootBox() self.foot_box.set_buttons([next_button]) self.foot_box.set_tip(hints) main_table.attach(self.foot_box, 0, 2, 1, 2) self.show_all()
def find_match_flag(self, country): formated_string = country.lower().replace(" ", "_").replace(",",'') try: return app_theme.get_pixbuf("network/flags/"+"flag_"+formated_string + ".png") except: return None