def create_signal_box(self):
        self.progress_table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
        self.progress_table.set_row_spacing(6)
        self.progress_table.set_column_spacing(12)
        self.pack_start(self.progress_table, False, True, 0)

        label = TextFieldLabel(_("Signal quality:"))
        self.progress_table.add(label)

        frame = Gtk.Frame(hexpand=True)
        frame.set_shadow_type(Gtk.ShadowType.NONE)
        self.progress_table.attach_next_to(frame, label,
                                           Gtk.PositionType.RIGHT, 1, 1)

        self.signal_quality_bar = Gtk.ProgressBar()
        self.signal_quality_bar.set_size_request(-1, 10)
        frame.add(self.signal_quality_bar)

        label = TextFieldLabel(_("Signal strength:"))
        self.progress_table.add(label)

        frame = Gtk.Frame(hexpand=True)
        frame.set_shadow_type(Gtk.ShadowType.NONE)
        self.progress_table.attach_next_to(frame, label,
                                           Gtk.PositionType.RIGHT, 1, 1)

        self.signal_strength_bar = Gtk.ProgressBar()
        self.signal_strength_bar.set_size_request(-1, 10)
        frame.add(self.signal_strength_bar)
示例#2
0
    def __init__(self, parent, model, device_type):
        Gtk.Dialog.__init__(self,
                            title=_("Add to Group"),
                            parent=parent,
                            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
                                     Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.__selected_group = None
        self.set_border_width(5)

        self.vbox_main = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                                 spacing=12)
        self.vbox_main.set_border_width(5)
        self.vbox_main.show()
        self.get_content_area().pack_start(self.vbox_main, True, True, 0)

        groupbox = Gtk.Box(spacing=18)
        groupbox.show()

        group_frame = BaseFrame("<b>%s</b>" % _("Add Device to Group"),
                                groupbox)
        group_frame.show()
        self.vbox_main.pack_start(group_frame, True, True, 0)

        group_label = TextFieldLabel()
        group_label.show()
        group_label.set_markup_with_mnemonic(_("_Group:"))
        groupbox.pack_start(group_label, False, False, 0)

        self.groups = Gtk.ListStore(str, GObject.TYPE_PYOBJECT)

        combo = Gtk.ComboBox.new_with_model(self.groups)
        combo.connect("changed", self.on_combo_changed)
        cell = Gtk.CellRendererText()
        combo.pack_start(cell, True)
        combo.add_attribute(cell, "text", 0)
        combo.show()
        group_label.set_mnemonic_widget(combo)
        groupbox.pack_start(combo, True, True, 0)

        def append_groups(groups):
            for group in groups:
                if group.get_type() == device_type:
                    name = group["name"]
                    if name == "":
                        name = "Group %d" % group["id"]
                    self.groups.append([name, group])

        model.get_registered_device_groups(result_handler=append_groups)
示例#3
0
    def __init__(self, parent, model, device_type):
        Gtk.Dialog.__init__(self, title=_("Add to Group"), parent=parent,
            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
                      Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.__selected_group = None
        self.set_border_width(5)

        self.vbox_main = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
        self.vbox_main.set_border_width(5)
        self.vbox_main.show()
        self.get_content_area().pack_start(self.vbox_main, True, True, 0)

        groupbox = Gtk.Box(spacing=18)
        groupbox.show()

        group_frame = BaseFrame("<b>%s</b>" % _("Add Device to Group"), groupbox)
        group_frame.show()
        self.vbox_main.pack_start(group_frame, True, True, 0)

        group_label = TextFieldLabel()
        group_label.show()
        group_label.set_markup_with_mnemonic(_("_Group:"))
        groupbox.pack_start(group_label, False, False, 0)

        self.groups = Gtk.ListStore(str, GObject.TYPE_PYOBJECT)

        combo = Gtk.ComboBox.new_with_model(self.groups)
        combo.connect("changed", self.on_combo_changed)
        cell = Gtk.CellRendererText()
        combo.pack_start(cell, True)
        combo.add_attribute(cell, "text", 0)
        combo.show()
        group_label.set_mnemonic_widget(combo)
        groupbox.pack_start(combo, True, True, 0)

        def append_groups(groups):
            for group in groups:
                if group.get_type() == device_type:
                    name = group["name"]
                    if name == "":
                        name = "Group %d" % group["id"]
                    self.groups.append([name, group])
        model.get_registered_device_groups(result_handler=append_groups)
示例#4
0
    def __init__(self,
                 parent,
                 device_group,
                 channel=None,
                 starttime=None,
                 duration=60):
        """
        @param parent: Parent window
        @type parent: Gtk.Window
        @param device_group: DeviceGroup instance
        """
        Gtk.Dialog.__init__(self, parent=parent)

        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.set_default_size(320, -1)

        self.device_group = device_group
        self.date_valid = False
        self.allowed_delta = datetime.timedelta(hours=1)

        self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
        self.ok_button = self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)

        self.set_border_width(5)

        table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
        table.set_column_spacing(18)
        table.set_row_spacing(6)
        table.set_border_width(5)
        self.get_content_area().pack_start(table, True, True, 0)

        label_channel = TextFieldLabel()
        table.add(label_channel)

        if channel == None:
            self.channel_selected = False
            self.set_title(_("Add Timer"))
            self.ok_button.set_sensitive(False)

            label_channel.set_markup_with_mnemonic(_("_Channel:"))
            self.channels = ChannelsStore(device_group)

            scrolledchannels = Gtk.ScrolledWindow(expand=True)
            scrolledchannels.set_policy(Gtk.PolicyType.AUTOMATIC,
                                        Gtk.PolicyType.AUTOMATIC)
            scrolledchannels.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
            table.attach_next_to(scrolledchannels, label_channel,
                                 Gtk.PositionType.BOTTOM, 2, 1)

            self.channelsview = ChannelsView(self.channels)
            self.channelsview.set_headers_visible(False)
            self.channelsview.get_selection().connect("changed",
                                                      self._on_channel_changed)
            scrolledchannels.add(self.channelsview)
            label_channel.set_mnemonic_widget(self.channelsview)
            self.channelsview.grab_focus()
        else:
            self.channel_selected = True
            self.set_title(_("Edit Timer"))
            self.ok_button.set_sensitive(True)

            label_channel.set_text(_("Channel:"))
            self.channels = None
            self.channelsview = None
            channel_label = TextFieldLabel(channel)
            table.attach_next_to(channel_label, label_channel,
                                 Gtk.PositionType.RIGHT, 1, 1)

        label_start = TextFieldLabel()
        label_start.set_markup_with_mnemonic(_("_Start time:"))
        table.add(label_start)

        hbox = Gtk.Box(spacing=6, hexpand=True)
        table.attach_next_to(hbox, label_start, Gtk.PositionType.RIGHT, 1, 1)

        if starttime == None:
            starttime = datetime.datetime.now()

        self.datetime_box = DateTimeBox(starttime)
        self.datetime_box.connect("changed", self._on_datetime_changed)
        hbox.pack_start(self.datetime_box, True, True, 0)
        label_start.set_mnemonic_widget(self.datetime_box)

        label_duration = TextFieldLabel()
        label_duration.set_markup_with_mnemonic(_("_Duration:"))
        table.add(label_duration)

        duration_hbox = Gtk.Box(spacing=6, hexpand=True)
        table.attach_next_to(duration_hbox, label_duration,
                             Gtk.PositionType.RIGHT, 1, 1)

        self.duration = Gtk.SpinButton()
        self.duration.set_range(1, 65535)
        self.duration.set_increments(1, 10)
        self.duration.set_width_chars(3)
        self.duration.set_value(60)
        duration_hbox.pack_start(self.duration, False, True, 0)
        label_duration.set_mnemonic_widget(self.duration)

        minutes_label = TextFieldLabel(_("minutes"))
        duration_hbox.pack_start(minutes_label, True, True, 0)

        self.set_start_time(starttime)
        self.set_duration(duration)

        table.show_all()
示例#5
0
    def __init__(self, model):
        BasePage.__init__(self)

        self._model = model
        self._scanner = None
        self._max_freqs = 0
        self._scanned_freqs = 0
        self._last_qsize = 0
        self._progressbar_timer = 0

        self.set_spacing(12)
        self._theme = Gtk.IconTheme.get_default()

        text = "%s\n%s" % (
            _("This process can take some time."),
            _("You can select the channels you want to have in your list of channels.")
        )
        self._label.set_markup (text)

        actiongroup = Gtk.ActionGroup('channels')
        actiongroup.add_actions([
            ('channels-select-all', None, _('Select all'), None, None,
                lambda x: self.__set_all_checked(True)),
            ('channels-deselect-all', None, _('Deselect all'), None, None,
                lambda x: self.__set_all_checked(False)),
        ])

        uimanager = Gtk.UIManager()
        uimanager.add_ui_from_string(self.MENU)
        uimanager.insert_action_group(actiongroup)

        self.popup_menu = uimanager.get_widget("/channels-popup")

        topbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.pack_start(topbox, True, True, 0)

        label = TextFieldLabel()
        label.set_markup_with_mnemonic(_("_Channels:"))
        topbox.pack_start(label, False, True, 0)

        # Logo, Name, active, SID, scrambled
        self.tvchannels = Gtk.ListStore(GdkPixbuf.Pixbuf, str, bool, int, bool)
        self.tvchannelsview = Gtk.TreeView.new_with_model(self.tvchannels)
        self.tvchannelsview.connect("button-press-event",
            self.__on_treeview_button_press_event)
        self.tvchannelsview.set_reorderable(True)
        self.tvchannelsview.set_headers_visible(False)
        label.set_mnemonic_widget(self.tvchannelsview)

        col_name = Gtk.TreeViewColumn(_("Channel"))

        cell_active = Gtk.CellRendererToggle()
        cell_active.connect("toggled", self.__on_active_toggled)
        col_name.pack_start(cell_active, False)
        col_name.add_attribute(cell_active, "active", self.COL_ACTIVE)

        cell_icon = Gtk.CellRendererPixbuf()
        col_name.pack_start(cell_icon, False)
        col_name.add_attribute(cell_icon, "pixbuf", self.COL_LOGO)

        cell_name = Gtk.CellRendererText()
        col_name.pack_start(cell_name, True)
        col_name.add_attribute(cell_name, "markup", self.COL_NAME)
        self.tvchannelsview.append_column (col_name)

        scrolledtvview = Gtk.ScrolledWindow()
        scrolledtvview.add(self.tvchannelsview)
        scrolledtvview.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        scrolledtvview.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

        topbox.pack_start(scrolledtvview, True, True, 0)

        self.scrambledbutton = Gtk.CheckButton.new_with_mnemonic(_("Select _scrambled channels"))
        self.scrambledbutton.set_active(True)
        self.scrambledbutton.connect("toggled", self.__on_select_encrypted_toggled)
        topbox.pack_start(self.scrambledbutton, False, True, 0)

        self.create_signal_box()

        self.progressbar = Gtk.ProgressBar()
        self.pack_start(self.progressbar, False, True, 0)
示例#6
0
    def __init__(self, parent):
        Gtk.Dialog.__init__(self, title=_("Create new Group"),
            parent=parent,
            flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
                      Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.set_default_size(400, 150)
        self.set_border_width(5)

        self.vbox_main = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
        self.vbox_main.set_border_width(5)
        self.vbox_main.show()
        self.get_content_area().pack_start(self.vbox_main, True, True, 0)

        self.table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
        self.table.set_column_spacing(18)
        self.table.set_row_spacing(6)
        self.table.show()

        general_frame = BaseFrame("<b>%s</b>" % _("General"), self.table)
        general_frame.show()
        self.vbox_main.pack_start(general_frame, True, True, 0)

        name = TextFieldLabel()
        name.set_markup_with_mnemonic(_("_Name:"))
        name.show()

        self.name_entry = Gtk.Entry(hexpand=True)
        self.name_entry.show()
        name.set_mnemonic_widget(self.name_entry)

        self.table.add(name)
        self.table.attach_next_to(self.name_entry, name, Gtk.PositionType.RIGHT, 1, 1)

        self.channels = TextFieldLabel()
        self.channels.set_markup_with_mnemonic(_("Channels _file:"))
        self.channels.show()

        self.channelsbox = Gtk.Box(spacing=6, hexpand=True)
        self.channelsbox.show()

        self.channels_entry = Gtk.Entry()
        self.channels_entry.set_editable(False)
        self.channels_entry.show()
        self.channelsbox.pack_start(self.channels_entry, True, True, 0)
        self.channels.set_mnemonic_widget(self.channels_entry)

        channels_open = Gtk.Button(stock=Gtk.STOCK_OPEN)
        channels_open.connect("clicked", self._on_channels_open_clicked)
        channels_open.show()
        self.channelsbox.pack_start(channels_open, False, False, 0)

        self.table.add(self.channels)
        self.table.attach_next_to(self.channelsbox, self.channels, Gtk.PositionType.RIGHT, 1, 1)

        recbox = Gtk.Box(spacing=18)
        recbox.show()

        recordings_frame = BaseFrame("<b>%s</b>" % _("Recordings"), recbox)
        recordings_frame.show()
        self.vbox_main.pack_start(recordings_frame, True, True, 0)

        recordings = TextFieldLabel()
        recordings.set_markup_with_mnemonic(_("_Directory:"))
        recordings.show()
        recbox.pack_start(recordings, False, True, 0)

        recentrybox = Gtk.Box(spacing=6)
        recentrybox.show()
        recbox.pack_start(recentrybox, True, True, 0)

        self.recordings_entry = Gtk.Entry()
        self.recordings_entry.set_editable(False)
        self.recordings_entry.show()
        recentrybox.pack_start(self.recordings_entry, True, True, 0)
        recordings.set_mnemonic_widget(self.recordings_entry)

        recordings_open = Gtk.Button(stock=Gtk.STOCK_OPEN)
        recordings_open.connect("clicked", self._on_recordings_open_clicked)
        recordings_open.show()
        recentrybox.pack_start(recordings_open, False, False, 0)
示例#7
0
    def __init__(self, parent=None):
        Gtk.Dialog.__init__(self, parent=parent)

        self.set_destroy_with_parent(True)
        self.set_default_size(440, 350)
        self.set_border_width(5)

        self.get_action_area().set_layout(Gtk.ButtonBoxStyle.EDGE)

        self.rec_button = Gtk.Button(stock=Gtk.STOCK_MEDIA_RECORD)
        self.rec_button.show()
        self.get_action_area().pack_start(self.rec_button, True, True, 0)

        close_button = self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
        close_button.grab_default()

        self.table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
        self.table.set_column_spacing(18)
        self.table.set_row_spacing(6)
        self.table.set_border_width(5)
        self.get_content_area().pack_start(self.table, True, True, 0)

        self._title = TextFieldLabel(hexpand=True)
        self._channel = TextFieldLabel(hexpand=True)
        self._date = TextFieldLabel(hexpand=True)
        self._duration = TextFieldLabel(hexpand=True)

        title_label = TextFieldLabel("<i>%s</i>" % _("Title:"))
        self.table.add(title_label)
        self.table.attach_next_to(self._title, title_label,
                                  Gtk.PositionType.RIGHT, 1, 1)

        channel_label = TextFieldLabel("<i>%s</i>" % _("Channel:"))
        self.table.add(channel_label)
        self.table.attach_next_to(self._channel, channel_label,
                                  Gtk.PositionType.RIGHT, 1, 1)

        date_label = TextFieldLabel("<i>%s</i>" % _("Date:"))
        self.table.add(date_label)
        self.table.attach_next_to(self._date, date_label,
                                  Gtk.PositionType.RIGHT, 1, 1)

        duration_label = TextFieldLabel("<i>%s</i>" % _("Duration:"))
        self.table.add(duration_label)
        self.table.attach_next_to(self._duration, duration_label,
                                  Gtk.PositionType.RIGHT, 1, 1)

        description_label = TextFieldLabel("<i>%s</i>" % _("Description:"))
        self.table.add(description_label)

        self.textview = Gtk.TextView()
        self.textview.set_editable(False)
        self.textview.set_wrap_mode(Gtk.WrapMode.WORD)
        self.textview.show()

        scrolledwin = Gtk.ScrolledWindow(expand=True)
        scrolledwin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolledwin.set_shadow_type(Gtk.ShadowType.IN)
        scrolledwin.set_margin_left(12)
        scrolledwin.add(self.textview)
        scrolledwin.show()
        self.table.attach_next_to(scrolledwin, description_label,
                                  Gtk.PositionType.BOTTOM, 2, 1)

        self.table.show_all()
示例#8
0
    def __init__(self, parent):
        Gtk.Dialog.__init__(
            self,
            title=_("Create new Group"),
            parent=parent,
            flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, Gtk.STOCK_OK,
                     Gtk.ResponseType.ACCEPT))
        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.set_default_size(400, 150)
        self.set_border_width(5)

        self.vbox_main = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                                 spacing=12)
        self.vbox_main.set_border_width(5)
        self.vbox_main.show()
        self.get_content_area().pack_start(self.vbox_main, True, True, 0)

        self.table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
        self.table.set_column_spacing(18)
        self.table.set_row_spacing(6)
        self.table.show()

        general_frame = BaseFrame("<b>%s</b>" % _("General"), self.table)
        general_frame.show()
        self.vbox_main.pack_start(general_frame, True, True, 0)

        name = TextFieldLabel()
        name.set_markup_with_mnemonic(_("_Name:"))
        name.show()

        self.name_entry = Gtk.Entry(hexpand=True)
        self.name_entry.show()
        name.set_mnemonic_widget(self.name_entry)

        self.table.add(name)
        self.table.attach_next_to(self.name_entry, name,
                                  Gtk.PositionType.RIGHT, 1, 1)

        self.channels = TextFieldLabel()
        self.channels.set_markup_with_mnemonic(_("Channels _file:"))
        self.channels.show()

        self.channelsbox = Gtk.Box(spacing=6, hexpand=True)
        self.channelsbox.show()

        self.channels_entry = Gtk.Entry()
        self.channels_entry.set_editable(False)
        self.channels_entry.show()
        self.channelsbox.pack_start(self.channels_entry, True, True, 0)
        self.channels.set_mnemonic_widget(self.channels_entry)

        channels_open = Gtk.Button(stock=Gtk.STOCK_OPEN)
        channels_open.connect("clicked", self._on_channels_open_clicked)
        channels_open.show()
        self.channelsbox.pack_start(channels_open, False, False, 0)

        self.table.add(self.channels)
        self.table.attach_next_to(self.channelsbox, self.channels,
                                  Gtk.PositionType.RIGHT, 1, 1)

        recbox = Gtk.Box(spacing=18)
        recbox.show()

        recordings_frame = BaseFrame("<b>%s</b>" % _("Recordings"), recbox)
        recordings_frame.show()
        self.vbox_main.pack_start(recordings_frame, True, True, 0)

        recordings = TextFieldLabel()
        recordings.set_markup_with_mnemonic(_("_Directory:"))
        recordings.show()
        recbox.pack_start(recordings, False, True, 0)

        recentrybox = Gtk.Box(spacing=6)
        recentrybox.show()
        recbox.pack_start(recentrybox, True, True, 0)

        self.recordings_entry = Gtk.Entry()
        self.recordings_entry.set_editable(False)
        self.recordings_entry.show()
        recentrybox.pack_start(self.recordings_entry, True, True, 0)
        recordings.set_mnemonic_widget(self.recordings_entry)

        recordings_open = Gtk.Button(stock=Gtk.STOCK_OPEN)
        recordings_open.connect("clicked", self._on_recordings_open_clicked)
        recordings_open.show()
        recentrybox.pack_start(recordings_open, False, False, 0)
    def __init__(self, model):
        BasePage.__init__(self)

        self._model = model
        self._scanner = None
        self._max_freqs = 0
        self._scanned_freqs = 0
        self._last_qsize = 0
        self._progressbar_timer = 0

        self.set_spacing(12)
        self._theme = Gtk.IconTheme.get_default()

        text = "%s\n%s" % (
            _("This process can take some time."),
            _("You can select the channels you want to have in your list of channels."
              ))
        self._label.set_markup(text)

        actiongroup = Gtk.ActionGroup('channels')
        actiongroup.add_actions([
            ('channels-select-all', None, _('Select all'), None, None,
             lambda x: self.__set_all_checked(True)),
            ('channels-deselect-all', None, _('Deselect all'), None, None,
             lambda x: self.__set_all_checked(False)),
        ])

        uimanager = Gtk.UIManager()
        uimanager.add_ui_from_string(self.MENU)
        uimanager.insert_action_group(actiongroup)

        self.popup_menu = uimanager.get_widget("/channels-popup")

        topbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.pack_start(topbox, True, True, 0)

        label = TextFieldLabel()
        label.set_markup_with_mnemonic(_("_Channels:"))
        topbox.pack_start(label, False, True, 0)

        # Logo, Name, active, SID, scrambled
        self.tvchannels = Gtk.ListStore(GdkPixbuf.Pixbuf, str, bool, int, bool)
        self.tvchannelsview = Gtk.TreeView.new_with_model(self.tvchannels)
        self.tvchannelsview.connect("button-press-event",
                                    self.__on_treeview_button_press_event)
        self.tvchannelsview.set_reorderable(True)
        self.tvchannelsview.set_headers_visible(False)
        label.set_mnemonic_widget(self.tvchannelsview)

        col_name = Gtk.TreeViewColumn(_("Channel"))

        cell_active = Gtk.CellRendererToggle()
        cell_active.connect("toggled", self.__on_active_toggled)
        col_name.pack_start(cell_active, False)
        col_name.add_attribute(cell_active, "active", self.COL_ACTIVE)

        cell_icon = Gtk.CellRendererPixbuf()
        col_name.pack_start(cell_icon, False)
        col_name.add_attribute(cell_icon, "pixbuf", self.COL_LOGO)

        cell_name = Gtk.CellRendererText()
        col_name.pack_start(cell_name, True)
        col_name.add_attribute(cell_name, "markup", self.COL_NAME)
        self.tvchannelsview.append_column(col_name)

        scrolledtvview = Gtk.ScrolledWindow()
        scrolledtvview.add(self.tvchannelsview)
        scrolledtvview.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        scrolledtvview.set_policy(Gtk.PolicyType.NEVER,
                                  Gtk.PolicyType.AUTOMATIC)

        topbox.pack_start(scrolledtvview, True, True, 0)

        self.scrambledbutton = Gtk.CheckButton.new_with_mnemonic(
            _("Select _scrambled channels"))
        self.scrambledbutton.set_active(True)
        self.scrambledbutton.connect("toggled",
                                     self.__on_select_encrypted_toggled)
        topbox.pack_start(self.scrambledbutton, False, True, 0)

        self.create_signal_box()

        self.progressbar = Gtk.ProgressBar()
        self.pack_start(self.progressbar, False, True, 0)
示例#10
0
    def __init__(self, parent, device_group, channel=None,
            starttime=None, duration=60):
        """
        @param parent: Parent window
        @type parent: Gtk.Window
        @param device_group: DeviceGroup instance
        """
        Gtk.Dialog.__init__(self, parent=parent)

        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.set_default_size(320, -1)

        self.device_group = device_group
        self.date_valid = False
        self.allowed_delta = datetime.timedelta(hours=1)

        self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
        self.ok_button = self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)

        self.set_border_width(5)

        table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
        table.set_column_spacing(18)
        table.set_row_spacing(6)
        table.set_border_width(5)
        self.get_content_area().pack_start(table, True, True, 0)

        label_channel = TextFieldLabel()
        table.add(label_channel)

        if channel == None:
            self.channel_selected = False
            self.set_title(_("Add Timer"))
            self.ok_button.set_sensitive(False)

            label_channel.set_markup_with_mnemonic(_("_Channel:"))
            self.channels = ChannelsStore(device_group)

            scrolledchannels = Gtk.ScrolledWindow(expand=True)
            scrolledchannels.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
            scrolledchannels.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
            table.attach_next_to(scrolledchannels, label_channel,
                Gtk.PositionType.BOTTOM, 2, 1)

            self.channelsview = ChannelsView(self.channels)
            self.channelsview.set_headers_visible(False)
            self.channelsview.get_selection().connect("changed",
                self._on_channel_changed)
            scrolledchannels.add(self.channelsview)
            label_channel.set_mnemonic_widget(self.channelsview)
            self.channelsview.grab_focus()
        else:
            self.channel_selected = True
            self.set_title(_("Edit Timer"))
            self.ok_button.set_sensitive(True)

            label_channel.set_text(_("Channel:"))
            self.channels = None
            self.channelsview = None
            channel_label = TextFieldLabel(channel)
            table.attach_next_to(channel_label, label_channel,
                Gtk.PositionType.RIGHT, 1, 1)

        label_start = TextFieldLabel()
        label_start.set_markup_with_mnemonic(_("_Start time:"))
        table.add(label_start)

        hbox = Gtk.Box(spacing=6, hexpand=True)
        table.attach_next_to(hbox, label_start, Gtk.PositionType.RIGHT, 1, 1)

        if starttime == None:
            starttime = datetime.datetime.now()

        self.datetime_box = DateTimeBox(starttime)
        self.datetime_box.connect("changed", self._on_datetime_changed)
        hbox.pack_start(self.datetime_box, True, True, 0)
        label_start.set_mnemonic_widget(self.datetime_box)

        label_duration = TextFieldLabel()
        label_duration.set_markup_with_mnemonic(_("_Duration:"))
        table.add(label_duration)

        duration_hbox = Gtk.Box(spacing=6, hexpand=True)
        table.attach_next_to(duration_hbox, label_duration,
            Gtk.PositionType.RIGHT, 1, 1)

        self.duration = Gtk.SpinButton()
        self.duration.set_range(1, 65535)
        self.duration.set_increments(1, 10)
        self.duration.set_width_chars(3)
        self.duration.set_value(60)
        duration_hbox.pack_start(self.duration, False, True, 0)
        label_duration.set_mnemonic_widget(self.duration)

        minutes_label = TextFieldLabel(_("minutes"))
        duration_hbox.pack_start(minutes_label, True, True, 0)

        self.set_start_time(starttime)
        self.set_duration(duration)

        table.show_all()
示例#11
0
    def __init__(self, parent=None):
        Gtk.Dialog.__init__(self, parent=parent)

        self.set_destroy_with_parent(True)
        self.set_default_size(440, 350)
        self.set_border_width(5)

        self.get_action_area().set_layout(Gtk.ButtonBoxStyle.EDGE)

        self.rec_button = Gtk.Button(stock=Gtk.STOCK_MEDIA_RECORD)
        self.rec_button.show()
        self.get_action_area().pack_start(self.rec_button, True, True, 0)

        close_button = self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
        close_button.grab_default()

        self.table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
        self.table.set_column_spacing(18)
        self.table.set_row_spacing(6)
        self.table.set_border_width(5)
        self.get_content_area().pack_start(self.table, True, True, 0)

        self._title = TextFieldLabel(hexpand=True)
        self._channel = TextFieldLabel(hexpand=True)
        self._date = TextFieldLabel(hexpand=True)
        self._duration = TextFieldLabel(hexpand=True)

        title_label = TextFieldLabel("<i>%s</i>" % _("Title:"))
        self.table.add(title_label)
        self.table.attach_next_to(self._title, title_label,
            Gtk.PositionType.RIGHT, 1, 1)

        channel_label = TextFieldLabel("<i>%s</i>" % _("Channel:"))
        self.table.add(channel_label)
        self.table.attach_next_to(self._channel, channel_label,
            Gtk.PositionType.RIGHT, 1, 1)

        date_label = TextFieldLabel("<i>%s</i>" % _("Date:"))
        self.table.add(date_label)
        self.table.attach_next_to(self._date, date_label,
            Gtk.PositionType.RIGHT, 1, 1)

        duration_label = TextFieldLabel("<i>%s</i>" % _("Duration:"))
        self.table.add(duration_label)
        self.table.attach_next_to(self._duration, duration_label,
            Gtk.PositionType.RIGHT, 1, 1)

        description_label = TextFieldLabel("<i>%s</i>" % _("Description:"))
        self.table.add(description_label)

        self.textview = Gtk.TextView()
        self.textview.set_editable(False)
        self.textview.set_wrap_mode(Gtk.WrapMode.WORD)
        self.textview.show()

        scrolledwin = Gtk.ScrolledWindow(expand=True)
        scrolledwin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolledwin.set_shadow_type(Gtk.ShadowType.IN)
        scrolledwin.set_margin_left(12)
        scrolledwin.add(self.textview)
        scrolledwin.show()
        self.table.attach_next_to(scrolledwin, description_label,
            Gtk.PositionType.BOTTOM, 2, 1)

        self.table.show_all()