class Template(Gtk.Box): def __init__( self, title, description, button_text, is_plug=False, back_btn=False ): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description, is_plug, back_btn) self.title.container.set_margin_bottom(0) self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.align = Gtk.Alignment(xscale=0, yscale=0, xalign=0.5, yalign=0.3) self.align.add(self.box) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.kano_button.align.set_padding(0, 30, 0, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.align, True, True, 0) self.pack_end(self.kano_button.align, False, False, 0) def set_prev_callback(self, cb): self.title.set_prev_callback(cb)
class Template(Gtk.Box): def __init__(self, title, description, button_text, is_plug=False, back_btn=False): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description, is_plug, back_btn) self.title.container.set_margin_bottom(0) self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.align = Gtk.Alignment(xscale=0, yscale=0, xalign=0.5, yalign=0.3) self.align.add(self.box) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.kano_button.align.set_padding(0, 30, 0, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.align, True, True, 0) self.pack_end(self.kano_button.align, False, False, 0) def set_prev_callback(self, cb): self.title.set_prev_callback(cb)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.win = win self.win.set_main_widget(self) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.win.go_to_home) self.added_or_removed_account = False main_heading = Heading(_("System account settings"), _("Set your account")) self.pass_button = KanoButton(_("CHANGE PASSWORD")) self.pass_button.pack_and_align() self.pass_button.connect('button-release-event', self.go_to_password_screen) self.pass_button.connect('key-release-event', self.go_to_password_screen) self.add_button = KanoButton(_("ADD ACCOUNT")) self.add_button.set_size_request(200, 44) self.add_button.connect('button-release-event', self.add_account) self.add_button.connect('key-release-event', self.add_account) self.remove_button = KanoButton(_("REMOVE ACCOUNT"), color='red') self.remove_button.set_size_request(200, 44) self.remove_button.connect('button-release-event', self.remove_account_dialog) self.remove_button.connect('key-release-event', self.remove_account_dialog) button_container = Gtk.Box() button_container.pack_start(self.add_button, False, False, 10) button_container.pack_start(self.remove_button, False, False, 10) button_align = Gtk.Alignment(xscale=0, xalign=0.5) button_align.add(button_container) accounts_heading = Heading(_("Accounts"), _("Add or remove accounts")) # Check if we already scheduled an account add or remove # We import kano-init locally to avoid circular dependency # the packages. try: from kano_init.utils import is_any_task_scheduled if is_any_task_scheduled(): self.disable_buttons() except ImportError: self.disable_buttons() self.pack_start(main_heading.container, False, False, 0) self.pack_start(self.pass_button.align, False, False, 0) self.pack_start(accounts_heading.container, False, False, 0) self.pack_start(button_align, False, False, 0) self.win.show_all()
def show_spinner_screen(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.set_size_request(self._win.width, self._win.height) self._win.set_main_widget(self) heading = Heading(self._title, self._description, self._win.is_plug()) self.pack_start(heading.container, False, False, 0) spinner = Gtk.Image() if self._win.is_plug(): filename = os.path.join(media_dir, "kano-wifi-gui/loading_bar.gif") else: filename = os.path.join(media_dir, "kano-wifi-gui/wifi-spinner-smaller.gif") anim = GdkPixbuf.PixbufAnimation.new_from_file(filename) spinner.set_from_animation(anim) if self._win.is_plug(): # Added extra padding for the plug screen. self.pack_start(spinner, False, False, 60) else: self.pack_start(spinner, False, False, 30) self._win.show_all()
def __init__(self, win, title, description, original_overscan=None): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.kano_button = KanoButton(_("APPLY CHANGES")) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.pack_and_align() self.heading = Heading(title, description) self.pack_start(self.heading.container, False, False, 0) self.win = win self.win.set_main_widget(self) self.win.top_bar.enable_prev() # Launch pipe for the overscan c code launch_pipe() self.overscan_values = get_overscan_status() self.original_overscan = original_overscan # Pass original overscan values between the classes # If original_overscan hasn't been generated yet, get it from current # overscan status. Alternatively, maybe read this from a file in future if original_overscan is None: self.original_overscan = get_overscan_status() # Reset button self.reset_button = OrangeButton() reset_icon_path = os.path.join(common.media, '/Icons/reset.png') reset_image = Gtk.Image().new_from_file(reset_icon_path) self.reset_button.set_image(reset_image) self.reset_button.connect('button_press_event', self.reset)
def __init__(self, title, description, button_text, orange_button_text=None): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.sw = ScrolledWindow() self.sw.apply_styling_to_widget(wide=False) self.title = Heading(title, description) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.pack_start(self.title.container, False, False, 0) self.pack_start(self.sw, True, True, 0) if orange_button_text: box_align = Gtk.Alignment(xscale=0, xalign=0.5) button_box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL, spacing=40) label = Gtk.Label("") self.orange_button = OrangeButton(orange_button_text) button_box.pack_start(label, False, False, 0) button_box.pack_start(self.kano_button.align, False, False, 0) button_box.pack_start(self.orange_button, False, False, 0) box_align.add(button_box) self.pack_start(box_align, False, False, 0) else: self.pack_start(self.kano_button.align, False, False, 0)
def __init__(self, title, description, left_btn_text, right_btn_text, buttons_shown): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description) self.title.container.set_margin_bottom(0) self.sw = ScrolledWindow() self.sw.apply_styling_to_widget(wide=False) self.left_button = KanoButton(left_btn_text, color='orange') self.right_button = KanoButton(right_btn_text, color='green') kano_button_box = Gtk.ButtonBox() kano_button_box.set_layout(Gtk.ButtonBoxStyle.CENTER) kano_button_box.set_spacing(20) if buttons_shown == 2: kano_button_box.pack_start(self.left_button, False, False, 0) kano_button_box.pack_start(self.right_button, False, False, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.sw, True, True, 0) self.pack_end(kano_button_box, False, False, 0)
def __init__(self, title, description, buttons, is_plug=False, img_path=None): super(Template, self).__init__(orientation=Gtk.Orientation.VERTICAL) self._focus_widget = None heading = Heading(title, description, is_plug, back_btn=False) bbox = Gtk.ButtonBox() bbox.set_spacing(20) bbox.set_layout(Gtk.ButtonBoxStyle.CENTER) bbox.set_margin_right(10) bbox.set_margin_left(10) for b in buttons: label = b["label"] if not label: gtk_button = Gtk.Label() else: button_type = b["type"] callback = b["callback"] if button_type == "KanoButton": color = b["color"] gtk_button = KanoButton(label, color=color) elif button_type == "OrangeButton": gtk_button = OrangeButton(label) gtk_button.connect("clicked", callback) bbox.pack_start(gtk_button, False, False, 0) if "focus" in b: self._focus_widget = gtk_button self.pack_start(heading.container, False, False, 0) heading.container.set_margin_right(15) heading.container.set_margin_left(15) if img_path: image = Gtk.Image.new_from_file(img_path) if is_plug: self.pack_start(image, False, False, 10) self.pack_start(bbox, False, False, 30) else: self.pack_start(image, False, False, 20) self.pack_end(bbox, False, False, 30) self.show_all()
def _create_main_box(self, network_list): '''Show the screen with the different WiFi networks ''' heading = Heading( _("Connect to WiFi"), _("Choose a network"), self._win.is_plug(), back_btn=False ) # This box is to pack everything in the window vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) # For now, pack the network into a scrolled window sw = ScrolledWindow() sw.apply_styling_to_widget() sw.set_size_request(-1, 215) sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) self._network_box = self._create_network_box(network_list) sw.add(self._network_box) # Pack the scrolled window into an event box to give the illusion of a # border sw_border = self._add_border_to_widget(sw) sw_border.set_margin_right(30) sw_border.set_margin_left(30) sw_border.set_margin_bottom(20) sw_border.set_margin_top(10) # Then pack all the elements into the vbox vbox.pack_start(heading.container, False, False, 0) vbox.pack_start(sw_border, False, False, 0) # Pack in the refresh connect buttons button_box = self._create_refresh_connect_buttons() vbox.pack_end(button_box, False, False, 30) return vbox
def __init__( self, win, wiface, network_name, encryption, wrong_password=False ): ''' Show the screen with the option of adding a password and connecting to a network ''' Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self._win = win self._win.set_main_widget(self) self._win.top_bar.enable_prev() self._wiface = wiface self._network_name = network_name self._encryption = encryption # Keep track if the user has already entered the wrong password before # so that we only pack the "password incorrect" label once self._wrong_password_used_before = False self._heading = Heading( "Connect to the network", self._network_name, self._win.is_plug(), True ) self._heading.set_prev_callback(self._refresh_networks) self._heading.container.set_margin_right(20) self._heading.container.set_margin_left(20) if wrong_password: image_path = os.path.join(img_dir, "password-fail.png") wrong_password = self._create_wrong_password_label() self._heading.container.pack_start(wrong_password, True, True, 0) else: image_path = os.path.join(img_dir, "password.png") self._padlock_image = Gtk.Image.new_from_file(image_path) self._password_entry = Gtk.Entry() self._password_entry.set_placeholder_text("Password") self._password_entry.set_visibility(False) self._password_entry.get_style_context().add_class("password_entry") self._password_entry.set_margin_left(60) self._password_entry.set_margin_right(60) self._password_entry.connect("key-release-event", self._set_button_sensitive) # If Enter key is pressed on the password entry, we want to act as # though the connect_btn was clicked self._password_entry.connect( "key-release-event", self._on_connect_key_wrapper ) self._connect_btn = KanoButton("CONNECT") self._connect_btn.connect('clicked', self._on_connect) self._connect_btn.set_sensitive(False) self._connect_btn.set_margin_right(100) self._connect_btn.set_margin_left(100) self._connect_btn.pack_and_align() self._show_password = Gtk.CheckButton.new_with_label("Show password") self._show_password.get_style_context().add_class("show_password") self._show_password.connect("toggled", self._change_password_entry_visiblity) self._show_password.set_active(True) self._show_password.set_margin_left(100) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(vbox) vbox.pack_start(self._heading.container, False, False, 10) vbox.pack_start(self._padlock_image, False, False, 10) vbox.pack_start(self._password_entry, False, False, 10) vbox.pack_start(self._show_password, False, False, 10) vbox.pack_end(self._connect_btn.align, False, False, 40) # Entry should have the keyboard focus self._password_entry.grab_focus() self.show_all()
class PasswordScreen(Gtk.Box): def __init__( self, win, wiface, network_name, encryption, wrong_password=False ): ''' Show the screen with the option of adding a password and connecting to a network ''' Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self._win = win self._win.set_main_widget(self) self._win.top_bar.enable_prev() self._wiface = wiface self._network_name = network_name self._encryption = encryption # Keep track if the user has already entered the wrong password before # so that we only pack the "password incorrect" label once self._wrong_password_used_before = False self._heading = Heading( "Connect to the network", self._network_name, self._win.is_plug(), True ) self._heading.set_prev_callback(self._refresh_networks) self._heading.container.set_margin_right(20) self._heading.container.set_margin_left(20) if wrong_password: image_path = os.path.join(img_dir, "password-fail.png") wrong_password = self._create_wrong_password_label() self._heading.container.pack_start(wrong_password, True, True, 0) else: image_path = os.path.join(img_dir, "password.png") self._padlock_image = Gtk.Image.new_from_file(image_path) self._password_entry = Gtk.Entry() self._password_entry.set_placeholder_text("Password") self._password_entry.set_visibility(False) self._password_entry.get_style_context().add_class("password_entry") self._password_entry.set_margin_left(60) self._password_entry.set_margin_right(60) self._password_entry.connect("key-release-event", self._set_button_sensitive) # If Enter key is pressed on the password entry, we want to act as # though the connect_btn was clicked self._password_entry.connect( "key-release-event", self._on_connect_key_wrapper ) self._connect_btn = KanoButton("CONNECT") self._connect_btn.connect('clicked', self._on_connect) self._connect_btn.set_sensitive(False) self._connect_btn.set_margin_right(100) self._connect_btn.set_margin_left(100) self._connect_btn.pack_and_align() self._show_password = Gtk.CheckButton.new_with_label("Show password") self._show_password.get_style_context().add_class("show_password") self._show_password.connect("toggled", self._change_password_entry_visiblity) self._show_password.set_active(True) self._show_password.set_margin_left(100) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(vbox) vbox.pack_start(self._heading.container, False, False, 10) vbox.pack_start(self._padlock_image, False, False, 10) vbox.pack_start(self._password_entry, False, False, 10) vbox.pack_start(self._show_password, False, False, 10) vbox.pack_end(self._connect_btn.align, False, False, 40) # Entry should have the keyboard focus self._password_entry.grab_focus() self.show_all() def _create_wrong_password_label(self): label = Gtk.Label("Password incorrect") label.get_style_context().add_class("wrong_password_label") return label def _change_password_entry_visiblity(self, widget): ''' Depending on the checkbox, change the writing in the password entry to be readable. ''' visibility = self._show_password.get_active() self._password_entry.set_visibility(visibility) def _refresh_networks(self, widget=None): from kano_wifi_gui.RefreshNetworks import RefreshNetworks RefreshNetworks(self._win) def _on_connect_key_wrapper(self, widget, event): if event.keyval == Gdk.KEY_Return: self._on_connect() def _on_connect(self, widget=None): passphrase = self._password_entry.get_text() ConnectToNetwork( self._win, self._network_name, passphrase, self._encryption ) def _set_button_sensitive(self, widget, event): self._connect_btn.set_sensitive(True) def _thread_finish(self, success): if success: self._success_screen() else: self._wrong_password_screen() def _success_screen(self): self._win.remove_main_widget() title = "Success!" description = "You're connected" buttons = [ { "label": "OK", "color": "green", "type": "KanoButton", "callback": Gtk.main_quit } ] img_path = os.path.join(img_dir, "internet.png") self._win.set_main_widget( Template( title, description, buttons, self._win.is_plug(), img_path ) ) def _disable_widgets_start_spinner(self): self._connect_btn.start_spinner() self._connect_btn.set_sensitive(False) self._win.top_bar.prev_button.set_sensitive(False) self._password_entry.set_sensitive(False) self._show_password.set_sensitive(False) def _enable_widgets_stop_spinner(self): self._connect_btn.stop_spinner() self._connect_btn.set_sensitive(True) self._win.top_bar.prev_button.set_sensitive(True) self._password_entry.set_sensitive(True) self._show_password.set_sensitive(True)
def __init__(self, win, wiface, network_name, encryption, wrong_password=False): ''' Show the screen with the option of adding a password and connecting to a network ''' Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self._win = win self._win.set_main_widget(self) self._win.top_bar.enable_prev() self._wiface = wiface self._network_name = network_name self._encryption = encryption # Keep track if the user has already entered the wrong password before # so that we only pack the "password incorrect" label once self._wrong_password_used_before = False self._heading = Heading(_("Connect to the network"), self._network_name, self._win.is_plug(), True) self._heading.set_prev_callback(self._refresh_networks) self._heading.container.set_margin_right(20) self._heading.container.set_margin_left(20) if wrong_password: image_path = os.path.join(img_dir, "password-fail.png") wrong_password = self._create_wrong_password_label() self._heading.container.pack_start(wrong_password, True, True, 0) else: image_path = os.path.join(img_dir, "password.png") self._padlock_image = Gtk.Image.new_from_file(image_path) self._password_entry = Gtk.Entry() self._password_entry.set_placeholder_text(_("Password")) self._password_entry.set_visibility(False) self._password_entry.get_style_context().add_class('password_entry') self._password_entry.set_margin_left(60) self._password_entry.set_margin_right(60) self._password_entry.connect('key-release-event', self._set_button_sensitive) # If Enter key is pressed on the password entry, we want to act as # though the connect_btn was clicked self._password_entry.connect('key-release-event', self._on_connect_key_wrapper) self._connect_btn = KanoButton(_("CONNECT")) self._connect_btn.connect('clicked', self._on_connect) self._connect_btn.set_sensitive(False) self._connect_btn.set_margin_right(100) self._connect_btn.set_margin_left(100) self._connect_btn.pack_and_align() self._show_password = Gtk.CheckButton.new_with_label( _("Show password")) self._show_password.get_style_context().add_class('show_password') self._show_password.connect('toggled', self._change_password_entry_visiblity) self._show_password.set_active(True) self._show_password.set_margin_left(100) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(vbox) vbox.pack_start(self._heading.container, False, False, 10) vbox.pack_start(self._padlock_image, False, False, 10) vbox.pack_start(self._password_entry, False, False, 10) vbox.pack_start(self._show_password, False, False, 10) vbox.pack_end(self._connect_btn.align, False, False, 40) # Entry should have the keyboard focus self._password_entry.grab_focus() self.show_all()
class PasswordScreen(Gtk.Box): def __init__(self, win, wiface, network_name, encryption, wrong_password=False): ''' Show the screen with the option of adding a password and connecting to a network ''' Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self._win = win self._win.set_main_widget(self) self._win.top_bar.enable_prev() self._wiface = wiface self._network_name = network_name self._encryption = encryption # Keep track if the user has already entered the wrong password before # so that we only pack the "password incorrect" label once self._wrong_password_used_before = False self._heading = Heading(_("Connect to the network"), self._network_name, self._win.is_plug(), True) self._heading.set_prev_callback(self._refresh_networks) self._heading.container.set_margin_right(20) self._heading.container.set_margin_left(20) if wrong_password: image_path = os.path.join(img_dir, "password-fail.png") wrong_password = self._create_wrong_password_label() self._heading.container.pack_start(wrong_password, True, True, 0) else: image_path = os.path.join(img_dir, "password.png") self._padlock_image = Gtk.Image.new_from_file(image_path) self._password_entry = Gtk.Entry() self._password_entry.set_placeholder_text(_("Password")) self._password_entry.set_visibility(False) self._password_entry.get_style_context().add_class('password_entry') self._password_entry.set_margin_left(60) self._password_entry.set_margin_right(60) self._password_entry.connect('key-release-event', self._set_button_sensitive) # If Enter key is pressed on the password entry, we want to act as # though the connect_btn was clicked self._password_entry.connect('key-release-event', self._on_connect_key_wrapper) self._connect_btn = KanoButton(_("CONNECT")) self._connect_btn.connect('clicked', self._on_connect) self._connect_btn.set_sensitive(False) self._connect_btn.set_margin_right(100) self._connect_btn.set_margin_left(100) self._connect_btn.pack_and_align() self._show_password = Gtk.CheckButton.new_with_label( _("Show password")) self._show_password.get_style_context().add_class('show_password') self._show_password.connect('toggled', self._change_password_entry_visiblity) self._show_password.set_active(True) self._show_password.set_margin_left(100) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(vbox) vbox.pack_start(self._heading.container, False, False, 10) vbox.pack_start(self._padlock_image, False, False, 10) vbox.pack_start(self._password_entry, False, False, 10) vbox.pack_start(self._show_password, False, False, 10) vbox.pack_end(self._connect_btn.align, False, False, 40) # Entry should have the keyboard focus self._password_entry.grab_focus() self.show_all() def _create_wrong_password_label(self): label = Gtk.Label(_("Password incorrect")) label.get_style_context().add_class('wrong_password_label') return label def _change_password_entry_visiblity(self, widget): ''' Depending on the checkbox, change the writing in the password entry to be readable. ''' visibility = self._show_password.get_active() self._password_entry.set_visibility(visibility) def _refresh_networks(self, widget=None): from kano_wifi_gui.RefreshNetworks import RefreshNetworks RefreshNetworks(self._win) def _on_connect_key_wrapper(self, widget, event): if event.keyval == Gdk.KEY_Return: self._on_connect() def _on_connect(self, widget=None): passphrase = self._password_entry.get_text() ConnectToNetwork(self._win, self._network_name, passphrase, self._encryption) def _set_button_sensitive(self, widget, event): ''' Enable the Connect button only if the passphrase is non empty ''' self._connect_btn.set_sensitive(widget.get_text_length() > 0) def _thread_finish(self, success): if success: self._success_screen() else: self._wrong_password_screen() def _success_screen(self): self._win.remove_main_widget() title = _("Success!") description = _("You're connected") buttons = [{ 'label': _("OK"), 'color': 'green', 'type': 'KanoButton', 'callback': Gtk.main_quit }] img_path = os.path.join(img_dir, "internet.png") # Track that user connected online track_action('internet-connection-established') self._win.set_main_widget( Template(title, description, buttons, self._win.is_plug(), img_path)) def _disable_widgets_start_spinner(self): self._connect_btn.start_spinner() self._connect_btn.set_sensitive(False) self._win.top_bar.prev_button.set_sensitive(False) self._password_entry.set_sensitive(False) self._show_password.set_sensitive(False) def _enable_widgets_stop_spinner(self): self._connect_btn.stop_spinner() self._connect_btn.set_sensitive(True) self._win.top_bar.prev_button.set_sensitive(True) self._password_entry.set_sensitive(True) self._show_password.set_sensitive(True)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.kano_button = KanoButton() self.win = win self.win.set_main_widget(self) self.heading = Heading(_("Proxy"), _("Connect via a friend")) grid = Gtk.Grid(column_homogeneous=False, column_spacing=10, row_spacing=10) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.go_to_wifi) self.ip_entry = Gtk.Entry() self.ip_entry.props.placeholder_text = _("IP address") self.ip_entry.connect('key-release-event', self.proxy_enabled) self.username_entry = Gtk.Entry() self.username_entry.props.placeholder_text = _("Username") self.username_entry.connect('key-release-event', self.proxy_enabled) self.port_entry = Gtk.Entry() self.port_entry.props.placeholder_text = _("Port") self.port_entry.connect('key-release-event', self.proxy_enabled) self.password_entry = Gtk.Entry() self.password_entry.props.placeholder_text = _("Password") self.password_entry.set_visibility(False) self.password_entry.connect('key-release-event', self.proxy_enabled) password_box = Gtk.Box() password_box.add(self.password_entry) self.checkbutton = Gtk.CheckButton(_("enable proxy")) self.read_config() self.checkbutton.connect('clicked', self.proxy_status) self.checkbutton.set_can_focus(False) bottom_row = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) bottom_row.pack_start(self.checkbutton, False, False, 0) bottom_row.pack_start(self.kano_button, False, False, 60) bottom_row.set_margin_bottom(30) bottom_row.set_margin_left(70) grid.attach(self.ip_entry, 0, 0, 2, 2) grid.attach(self.username_entry, 0, 2, 2, 2) grid.attach(self.port_entry, 2, 0, 2, 2) grid.attach(password_box, 2, 2, 3, 2) grid_alignment = Gtk.Alignment(xscale=0, xalign=0.5, yscale=0, yalign=0.2) grid_alignment.add(grid) self.pack_start(self.heading.container, False, False, 0) self.pack_start(grid_alignment, True, True, 0) self.pack_end(bottom_row, False, False, 0) self.proxy_status(self.checkbutton) self.kano_button.set_sensitive(False) # Change text of kano button depending on if proxy is enabled if self.checkbutton.get_active(): self.kano_button.set_label(_("ENABLE PROXY")) else: self.kano_button.set_label(_("DISABLE PROXY")) self.win.show_all()