예제 #1
0
    def __init__(self, win):
        Template.__init__(self,
                          _("Bluetooth"),
                          _("Connect to bluetooth devices"),
                          _("APPLY CHANGES"),
                          win.is_plug(),
                          back_btn=True)

        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._overlay = BlurOverlay()
        self.box.pack_start(self._overlay, False, False, 0)

        self._contents = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.fill_contents()
        self._overlay.add(self._contents)

        self._refresh_btn = None
        self._done_btn = None
        self._arrange_buttons()

        self.show_all()

        self.dev_list.refresh()
예제 #2
0
    def __init__(self, win):
        Template.__init__(
            self,
            _("Bluetooth"),
            _("Connect to bluetooth devices"),
            _("APPLY CHANGES"),
            win.is_plug(),
            back_btn=True
        )

        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._overlay = BlurOverlay()
        self.box.pack_start(self._overlay, False, False, 0)

        self._contents = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.fill_contents()
        self._overlay.add(self._contents)

        self._refresh_btn = None
        self._done_btn = None
        self._arrange_buttons()

        self.show_all()

        self.dev_list.refresh()
예제 #3
0
class BluetoothConfig(Template):

    def __init__(self, win):
        Template.__init__(
            self,
            _("Bluetooth"),
            _("Connect to bluetooth devices"),
            _("APPLY CHANGES"),
            win.is_plug(),
            back_btn=True
        )

        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._overlay = BlurOverlay()
        self.box.pack_start(self._overlay, False, False, 0)

        self._contents = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.fill_contents()
        self._overlay.add(self._contents)

        self._refresh_btn = None
        self._done_btn = None
        self._arrange_buttons()

        self.show_all()

        self.dev_list.refresh()

    def _arrange_buttons(self):
        self.remove(self.kano_button.align)

        btn_box = Gtk.Box()
        btn_box.set_valign(Gtk.Align.CENTER)
        btn_box.set_halign(Gtk.Align.CENTER)
        btn_box.set_margin_top(30)
        btn_box.set_margin_bottom(30)

        self._refresh_btn = refresh_button = KanoButton(color='orange')
        refresh_icon_filepath = os.path.join(IMAGES_DIR, 'refresh.png')
        refresh_icon = Gtk.Image.new_from_file(refresh_icon_filepath)
        refresh_button.set_image(refresh_icon)
        refresh_button.set_margin_right(10)
        refresh_button.connect('clicked', self.dev_list.refresh)
        btn_box.pack_start(refresh_button, False, False, 0)

        self._done_button = done_btn = KanoButton(_("DONE"))
        done_btn.connect('clicked', self.win.go_to_home)
        btn_box.pack_start(done_btn, False, False, 0)

        self.pack_end(btn_box, False, False, 0)

    def fill_contents(self):
        self.dev_list = BluetoothDevicesList()
        self.dev_list.connect('loading', self.blur)
        self.dev_list.connect('done-loading', self.unblur)
        self._contents.pack_start(self.dev_list, False, False, 0)

    def blur(self, *dummy_args, **dummy_kwargs):
        self._overlay.blur()
        self._refresh_btn.set_sensitive(False)
        self._done_button.set_sensitive(False)
        self.win.top_bar.disable_prev()

    def unblur(self, *dummy_args, **dummy_kwargs):
        self._overlay.unblur()
        self._refresh_btn.set_sensitive(True)
        self._done_button.set_sensitive(True)
        self.win.top_bar.enable_prev()
예제 #4
0
class BluetoothConfig(Template):
    def __init__(self, win):
        Template.__init__(self,
                          _("Bluetooth"),
                          _("Connect to bluetooth devices"),
                          _("APPLY CHANGES"),
                          win.is_plug(),
                          back_btn=True)

        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._overlay = BlurOverlay()
        self.box.pack_start(self._overlay, False, False, 0)

        self._contents = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.fill_contents()
        self._overlay.add(self._contents)

        self._refresh_btn = None
        self._done_btn = None
        self._arrange_buttons()

        self.show_all()

        self.dev_list.refresh()

    def _arrange_buttons(self):
        self.remove(self.kano_button.align)

        btn_box = Gtk.Box()
        btn_box.set_valign(Gtk.Align.CENTER)
        btn_box.set_halign(Gtk.Align.CENTER)
        btn_box.set_margin_top(30)
        btn_box.set_margin_bottom(30)

        self._refresh_btn = refresh_button = KanoButton(color='orange')
        refresh_icon_filepath = os.path.join(IMAGES_DIR, 'refresh.png')
        refresh_icon = Gtk.Image.new_from_file(refresh_icon_filepath)
        refresh_button.set_image(refresh_icon)
        refresh_button.set_margin_right(10)
        refresh_button.connect('clicked', self.dev_list.refresh)
        btn_box.pack_start(refresh_button, False, False, 0)

        self._done_button = done_btn = KanoButton(_("DONE"))
        done_btn.connect('clicked', self.win.go_to_home)
        btn_box.pack_start(done_btn, False, False, 0)

        self.pack_end(btn_box, False, False, 0)

    def fill_contents(self):
        self.dev_list = BluetoothDevicesList()
        self.dev_list.connect('loading', self.blur)
        self.dev_list.connect('done-loading', self.unblur)
        self._contents.pack_start(self.dev_list, False, False, 0)

    def blur(self, *dummy_args, **dummy_kwargs):
        self._overlay.blur()
        self._refresh_btn.set_sensitive(False)
        self._done_button.set_sensitive(False)
        self.win.top_bar.disable_prev()

    def unblur(self, *dummy_args, **dummy_kwargs):
        self._overlay.unblur()
        self._refresh_btn.set_sensitive(True)
        self._done_button.set_sensitive(True)
        self.win.top_bar.enable_prev()