Exemplo n.º 1
0
    def build_label(self, node, label):
        widget = g.Label(self._(data(node)))
        help = int(node.getAttribute('help') or '0')
        if help:
            widget.set_alignment(0, 0.5)
        else:
            widget.set_alignment(0, 1)
        widget.set_justify(g.JUSTIFY_LEFT)
        widget.set_line_wrap(True)

        if help:
            hbox = g.HBox(False, 4)
            image = g.Image()
            image.set_from_stock(g.STOCK_DIALOG_INFO, g.ICON_SIZE_BUTTON)
            align = g.Alignment(0, 0, 0, 0)

            align.add(image)
            hbox.pack_start(align, False, True, 0)
            hbox.pack_start(widget, False, True, 0)

            spacer = g.EventBox()
            spacer.set_size_request(6, 6)

            return [hbox, spacer]
        return [widget]
Exemplo n.º 2
0
def build_i18n_message(box, node, label):
    widget = g.Label(
        _("""Note that you must save your choices, 
log out and log back in for the new language
setting to take full effect."""))
    widget.set_alignment(0, 0.5)
    widget.set_justify(g.JUSTIFY_LEFT)
    widget.set_line_wrap(True)

    hbox = g.HBox(False, 4)
    image = g.image_new_from_stock(g.STOCK_DIALOG_INFO, g.ICON_SIZE_BUTTON)
    align = g.Alignment(0, 0, 0, 0)

    align.add(image)
    hbox.pack_start(align, False, True, 0)
    hbox.pack_start(widget, False, True, 0)

    return [hbox]
Exemplo n.º 3
0
    def _create_drag_area(self, type):
        align = g.Alignment()
        align.set(.5, .5, 0, 0)

        self.drag_box = g.EventBox()
        self.drag_box.set_border_width(4)
        self.drag_box.add_events(gdk.BUTTON_PRESS_MASK)
        align.add(self.drag_box)

        self.icon = g.Image()
        self._set_icon(type)

        self._set_drag_source(type)
        self.drag_box.connect('drag_begin', self.drag_begin)
        self.drag_box.connect('drag_end', self.drag_end)
        self.drag_box.connect('drag_data_get', self.drag_data_get)
        self.drag_in_progress = 0

        self.drag_box.add(self.icon)

        return align
Exemplo n.º 4
0
def _build_show_log(box, node, label):
    align = g.Alignment(0.5, 0.5, 0, 0)
    button = rox.ButtonMixed(g.STOCK_YES, _("Show message log"))
    align.add(button)
    button.connect('clicked', lambda b: log.show_log_window())
    return [align]
Exemplo n.º 5
0
    def __init__(self, memo=None):
        g.Dialog.__init__(self)
        self.set_has_separator(FALSE)

        self.add_button(g.STOCK_HELP, g.RESPONSE_HELP)

        if memo:
            self.add_button(g.STOCK_DELETE, DELETE)

            button = rox.ButtonMixed(g.STOCK_ZOOM_OUT, _('_Hide'))
            button.set_flags(g.CAN_DEFAULT)
            self.add_action_widget(button, HIDE)

        self.add_button(g.STOCK_CANCEL, g.RESPONSE_CANCEL)

        button = rox.ButtonMixed(g.STOCK_YES, _('_Set'))
        button.set_flags(g.CAN_DEFAULT)
        self.add_action_widget(button, g.RESPONSE_YES)

        self.memo = memo
        if memo:
            self.set_title(_("Edit memo:"))
            t = time.localtime(memo.time)
        else:
            self.set_title(_("Create memo:"))
            t = time.localtime(time.time() + 5 * 60)

        year, month, day, hour, minute, second, weekday, julian, dst = t
        self.hour = hour
        self.min = minute

        self.cal = g.Calendar()
        self.cal.select_month(month - 1, year)
        self.cal.select_day(day)

        at_box = self.make_at_box()
        self.advanced_box = self.make_advanced_box()

        text_frame = self.make_text_view()

        # Time/Date on the left, Text on the right
        hbox = g.HBox(FALSE, 0)
        self.vbox.pack_start(hbox, TRUE, TRUE, 0)

        self.vbox.pack_start(self.advanced_box, FALSE, TRUE, 0)

        # Date above time
        vbox = g.VBox(FALSE, 0)
        hbox.pack_start(vbox, FALSE, TRUE, 0)
        vbox.set_border_width(4)
        vbox.pack_start(self.cal, FALSE, TRUE, 0)

        spacer = g.Alignment()
        vbox.pack_start(spacer, FALSE, TRUE, 2)

        vbox.pack_start(at_box, FALSE, TRUE, 0)

        hbox.pack_start(text_frame, TRUE, TRUE, 0)

        self.vbox.show_all()

        if memo:
            buffer = self.text.get_buffer()
            try:
                buffer.insert_at_cursor(memo.message)
            except TypeError:
                buffer.insert_at_cursor(memo.message, -1)
        if memo and memo.at:
            self.at.set_active(TRUE)
            self.at.set_label(_('At'))
            self.advanced_box.set_sensitive(TRUE)
        if memo == None or memo.at == 0:
            self.at_box.hide()
            self.at.set_label(_('At') + "...")
            self.advanced_box.set_sensitive(FALSE)
        if memo:
            if memo.nosound:
                self.sound_choice.set_active(2)
            elif memo.soundfile is not None and memo.soundfile != "":
                self.sound_choice.set_active(1)
                self.sound_entry.set_filename(memo.soundfile)
                self.sound_entry.set_sensitive(TRUE)
            else:
                self.sound_choice.set_active(0)

        self.connect('response', self.response)
        self.text.grab_focus()
        self.set_default_response(g.RESPONSE_YES)

        self.connect('destroy', lambda w: refleak_bug_workaround.remove(self))
        refleak_bug_workaround.append(self)