示例#1
0
    def __init__(self, parent, coherence):
        super(SelectMRDialog,
              self).__init__(parent=parent,
                             buttons=(gtk.STOCK_APPLY, gtk.RESPONSE_ACCEPT))
        self.set_title(_("Select a MediaRenderer"))
        self.mrs = []
        self.mediarenderer_picker = hildon.PickerButton(
            gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
        selector = hildon.TouchSelectorEntry(text=True)
        self.mediarenderer_picker.set_title(_('Mediarenderer:'))
        for device in coherence.devices:
            if device.get_friendly_device_type().lower() == "mediarenderer":
                self.mrs.append(device)
                selector.append_text(device.get_friendly_name())

        self.mediarenderer_picker.set_selector(selector)

        if self.mrs:
            self.mediarenderer_picker.set_active(0)

        self.vbox.add(self.mediarenderer_picker)
        self.vbox.show_all()
示例#2
0
    def __init__(self, weboob):
        self.touch_selector_entry_filled = False
        self.refresh_in_progress = False
        self.connected = False
        self.weboob = weboob
        try:
            self.connection = conic.Connection()
            self.connection.connect("connection-event", self.connect_event)
            self.connection.set_property("automatic-connection-events", True)
            self.connection.request_connection(conic.CONNECT_FLAG_NONE)
        except NotImplementedError:
            pass

        horizontal_box = gtk.HBox()
        self.main_window = toolkit.Window()
        try:
            self.refresh_button = toolkit.Button(
                gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
                hildon.BUTTON_ARRANGEMENT_HORIZONTAL, "Actualiser")
            self.retour_button = hildon.Button(
                gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
                hildon.BUTTON_ARRANGEMENT_HORIZONTAL, "Retour")
            self.combo_source = hildon.TouchSelectorEntry(text=True)
            self.combo_dest = hildon.TouchSelectorEntry(text=True)
            self.picker_button_source = hildon.PickerButton(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL)

            self.picker_button_dest = hildon.PickerButton(
                gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL)
            self.picker_button_source.set_sensitive(False)
            self.picker_button_dest.set_sensitive(False)

            self.picker_button_source.set_title("Gare de Depart")
            self.picker_button_dest.set_title("Gare d'arrivee")

            self.picker_button_source.set_selector(self.combo_source)
            self.picker_button_dest.set_selector(self.combo_dest)
            horizontal_box.pack_start(self.picker_button_source)
            horizontal_box.pack_start(self.picker_button_dest)

        except AttributeError:
            self.refresh_button = gtk.Button("Actualiser")
            self.retour_button = gtk.Button("Retour")
            self.combo_source = gtk.combo_box_entry_new_text()
            self.combo_dest = gtk.combo_box_entry_new_text()
            horizontal_box.pack_start(self.combo_source)
            horizontal_box.pack_start(self.combo_dest)

        self.main_window.set_title("Horaires des Prochains Trains")
        self.main_window.connect("destroy", self.on_main_window_destroy)

        self.refresh_button.connect("clicked", self.on_refresh_button_clicked)

        self.retour_button.set_sensitive(False)
        self.retour_button.connect("clicked", self.on_retour_button_clicked)

        self.treestore = gtk.TreeStore(str, str, str, str, str)
        treeview = gtk.TreeView(self.treestore)

        treeview.append_column(
            gtk.TreeViewColumn('Train', gtk.CellRendererText(), text=0))

        treeview.append_column(
            gtk.TreeViewColumn('Horaire', gtk.CellRendererText(), text=1))

        treeview.append_column(
            gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=2))
        treeview.append_column(
            gtk.TreeViewColumn('Voie', gtk.CellRendererText(), text=3))
        treeview.append_column(
            gtk.TreeViewColumn('Information', gtk.CellRendererText(), text=4))

        vertical_box = gtk.VBox()
        vertical_box.pack_start(horizontal_box)
        horizontal_box.pack_start(self.retour_button)
        vertical_box.pack_start(treeview)
        vertical_box.pack_start(self.refresh_button)

        self.main_window.add(vertical_box)
        self.main_window.show_all()
        self.fill_touch_selector_entry()

        if toolkit != gtk:
            self.picker_button_source.connect("value-changed",
                                              self.check_station_input,
                                              self.picker_button_source)
            self.picker_button_dest.connect("value-changed",
                                            self.check_station_input,
                                            self.picker_button_dest)
 def testBasic(self):
     entry = hildon.TouchSelectorEntry()
     self.assert_(isinstance(entry, hildon.TouchSelectorEntry))
     self.assertEqual(entry.get_text_column(), -1)
 def testWithText(self):
     entry = hildon.TouchSelectorEntry(text=True)
     self.assert_(isinstance(entry, hildon.TouchSelectorEntry))
     self.assertEqual(entry.get_text_column(), 0)
示例#5
0
    def __init__(self, parent, mirabeau_section, media_server_enabled):
        super(SettingsDialog,
              self).__init__(parent=parent,
                             buttons=(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
        self.set_title(_("Settings"))

        self.accounts = []
        bus = dbus.SessionBus()

        # account
        conf_account = mirabeau_section.get("account")
        index = -1
        accounts = connect.gabble_accounts()
        self.account_picker = hildon.PickerButton(
            gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
        selector = hildon.TouchSelectorEntry(text=True)
        self.account_picker.set_title(_('Account:'))
        for account_obj_path in accounts:
            account_obj = bus.get_object(ACCOUNT_MANAGER, account_obj_path)
            norm_name = account_obj.Get(ACCOUNT, 'NormalizedName')
            nick_name = account_obj.Get(ACCOUNT, 'Nickname')
            parameters = account_obj.Get(ACCOUNT, 'Parameters')
            if "" in (nick_name, norm_name):
                label = parameters["account"]
            else:
                label = "%s - %s" % (nick_name, norm_name)
            selector.append_text(label)
            self.accounts.append((account_obj_path, nick_name))
            if account_obj_path == conf_account:
                index = accounts.index(account_obj_path)

        self.account_picker.set_selector(selector)
        if index > -1:
            self.account_picker.set_active(index)

        self.vbox.pack_start(self.account_picker, expand=False)

        # conf server
        self.conf_server_label = gtk.Label(_("Conference Server"))
        self.conf_server_entry = hildon.Entry(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.conf_server_entry.set_text(
            mirabeau_section.get("conference-server", ""))
        self.conf_server_hbox = gtk.HBox()
        self.conf_server_hbox.pack_start(self.conf_server_label, expand=False)
        self.conf_server_hbox.pack_start(self.conf_server_entry, expand=True)
        self.vbox.pack_start(self.conf_server_hbox, expand=False)

        # chatroom name
        self.chatroom_label = gtk.Label(_("Chatroom"))
        self.chatroom_entry = hildon.Entry(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.chatroom_entry.set_text(mirabeau_section.get("chatroom", ""))
        self.chatroom_hbox = gtk.HBox()
        self.chatroom_hbox.pack_start(self.chatroom_label, expand=False)
        self.chatroom_hbox.pack_start(self.chatroom_entry, expand=True)
        self.vbox.pack_start(self.chatroom_hbox, expand=False)

        # MS toggle
        self.ms_toggle = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.ms_toggle.set_label(_("Share the media files of this device"))
        self.ms_toggle.set_active(media_server_enabled)
        self.vbox.pack_start(self.ms_toggle, expand=False)

        self.vbox.show_all()