Exemplo n.º 1
0
    def __init__(self, name, properties):
        SizedObjectForm.__init__(self, name, properties)

        self.canvas = properties.canvas
        self.add_section(_("Color"))

        entry = Options()
        entry.add_option(_("Color"))
        entry.add_option(_("Gradient"))
        entry.add_option(_("Pattern"))
        #entry = gtk.HButtonBox()
        #entry.set_layout(gtk.BUTTONBOX_SPREAD)
        #entry.set_spacing(10)
        #entry.add(gtk.ToggleButton(_("Color")))
        #entry.add(gtk.ToggleButton(_("Gradient")))
        #entry.add(gtk.ToggleButton(_("Pattern")))
        self.add_entry(_("Fill style"), entry, "fill_style")

        entry = gtk.ColorButton()
        entry.set_use_alpha(True)
        entry.connect("color-set", self.set_stroke_color)
        self.add_entry(_("Stroke"), entry, "foreground")

        entry = gtk.ColorButton()
        entry.set_use_alpha(True)
        entry.connect("color-set", self.set_fill_color)
        self.add_entry(_("Fill"), entry, "background")

        entry = LinearGradientEditor()
        entry.connect("update", self.set_gradient)
        self.add_entry(_("Gradient"), entry, "gradient")
Exemplo n.º 2
0
    def getAdvancedPane(self):
        detailstable = gtk.Table(4, 2, False)
        detailstable.set_row_spacings(2)
        detailstable.set_col_spacings(2)

        masklabel = gtk.Label("Mask")
        maskalign = gtk.Alignment(0.0, 0.5, 0.0, 0.0)
        maskalign.add(masklabel)
        maskadj = gtk.Adjustment(0, 0, 8, 1, 0, 0)
        self.maskspinner = gtk.SpinButton(maskadj, 0.1, 0)
        self.maskspinner.set_wrap(True)
        self.maskspinner.connect("value-changed", self.sichanged)
        self.maskspinner.connect("output", self.output)
        detailstable.attach(maskalign, 0, 1, 0, 1, gtk.FILL, gtk.FILL, 2, 0)
        detailstable.attach(self.maskspinner, 1, 2, 0, 1,
                            gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)

        quietlabel = gtk.Label("Quiet Zone")
        quietalign = gtk.Alignment(0.0, 0.5, 0.0, 0.0)
        quietalign.add(quietlabel)
        self.quietbutton = gtk.CheckButton(None, False)
        self.quietbutton.connect("toggled", self.pcchanged)
        detailstable.attach(quietalign, 0, 1, 1, 2, gtk.FILL, gtk.FILL, 2, 0)
        detailstable.attach(self.quietbutton, 1, 2, 1, 2,
                            gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)

        repaintWhileTypinglabel = gtk.Label("Live update")
        repaintWhileTypingalign = gtk.Alignment(0.0, 0.5, 0.0, 0.0)
        repaintWhileTypingalign.add(repaintWhileTypinglabel)
        self.repaintWhileTypingbutton = gtk.CheckButton(None, False)
        detailstable.attach(repaintWhileTypingalign, 0, 1, 2, 3, gtk.FILL,
                            gtk.FILL, 2, 0)
        detailstable.attach(self.repaintWhileTypingbutton, 1, 2, 2, 3,
                            gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)

        foregroundlabel = gtk.Label("Foreground")
        forealign = gtk.Alignment(0.0, 0.5, 0.0, 0.0)
        forealign.add(foregroundlabel)
        self.forebutton = gtk.ColorButton(gtk.gdk.Color(0, 0, 0))
        self.forebutton.set_use_alpha(True)
        self.forebutton.connect("color-set", self.pcchanged)
        detailstable.attach(forealign, 0, 1, 3, 4, gtk.FILL, gtk.FILL, 2, 0)
        detailstable.attach(self.forebutton, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL,
                            gtk.EXPAND | gtk.FILL, 0, 0)

        backgroundlabel = gtk.Label("Background")
        backalign = gtk.Alignment(0.0, 0.5, 0.0, 0.0)
        backalign.add(backgroundlabel)
        self.backbutton = gtk.ColorButton(gtk.gdk.Color(
            -1, -1, -1))  # -1 overflows to uint_max
        self.backbutton.set_use_alpha(True)
        self.backbutton.connect("color-set", self.pcchanged)
        detailstable.attach(backalign, 0, 1, 4, 5, gtk.FILL, gtk.FILL, 2, 0)
        detailstable.attach(self.backbutton, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL,
                            gtk.EXPAND | gtk.FILL, 0, 0)

        frame = ExpanderFrame(detailstable, "Advanced Settings")

        return frame
 def _create_widgets(self):
     self.table = HIGTable()
     
     self.unchanged_button = gtk.ColorButton(self.colors.unchanged)
     self.unchanged_label = gtk.Label(_("Property remained <b>U</b>nchanged"))
     
     self.added_button = gtk.ColorButton(self.colors.added)
     self.added_label = gtk.Label(_("Property was <b>A</b>dded"))
     
     self.modified_button = gtk.ColorButton(self.colors.modified)
     self.modified_label = gtk.Label(_("Property was <b>M</b>odified"))
     
     self.not_present_button = gtk.ColorButton(self.colors.not_present)
     self.not_present_label = gtk.Label(_("Property is <b>N</b>ot present"))
Exemplo n.º 4
0
    def __init__(self, cfg):
        gtk.Dialog.__init__(self, 'Preferences', None, gtk.DIALOG_MODAL,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                             gtk.STOCK_OK, gtk.RESPONSE_OK))
        self.set_default_size(0, 0)

        self.cfg = copy(cfg)

        file_chooser = gtk.FileChooserButton('Select interpreter path')
        file_chooser.connect('file_set', self.set_file)

        table = gtk.Table(6, 2)

        l = gtk.Label('Interpreter path')
        l.set_alignment(0, 0)
        table.attach(l, 0, 1, 0, 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
        table.attach(file_chooser, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)

        row = 1
        for cl in self.colors:
            l = gtk.Label(cl[1])
            l.set_alignment(0, 0)
            table.attach(l, 0, 1, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)

            l = gtk.ColorButton(
                gtk.gdk.color_parse(self.cfg.get('config', cl[0])))
            l.connect('color-set', self.set_color, cl[0])
            table.attach(l, 1, 2, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)

            row += 1

        self.get_content_area().pack_start(table, expand=False, fill=False)
	def __init__(self):
		super(SpotifyWW, self).__init__()
		self.set_title("Spotify Widget")

		self.label_color = gtk.Label("Color:")
		self.form_color = gtk.ColorButton()
		self.form_color.set_color(gtk.gdk.color_parse("#0000FFFF0000"))

		self.label_size = gtk.Label("Size:")
		self.form_size = gtk.SpinButton(adjustment = gtk.Adjustment(12.0, 2.0, 512.0, 1.0, 10.0, 0.0), digits = 0)

		self.table.attach(self.label_path, 0, 2, 0, 1)
		self.table.attach(self.form_path, 2, 4, 0, 1)
		self.table.attach(self.label_pos, 0, 2, 1, 2)
		self.table.attach(self.form_pos_x, 2, 3, 1, 2)
		self.table.attach(self.form_pos_y, 3, 4, 1, 2)
		self.table.attach(self.label_alpha, 0, 2, 2, 3)
		self.table.attach(self.form_alpha, 2, 4, 2, 3)
		self.table.attach(self.label_angle, 0, 2, 3, 4)
		self.table.attach(self.form_angle, 2, 4, 3, 4)
		self.table.attach(self.label_color, 0, 2, 4, 5)
		self.table.attach(self.form_color, 2, 4, 4, 5)
		self.table.attach(self.label_size, 0, 2, 5, 6)
		self.table.attach(self.form_size, 2, 4, 5, 6)
		self.table.attach(self.button_preview, 0, 4, 6, 7)
		self.table.attach(self.button_go, 0, 4, 7, 8)
		self.add(self.table)
		self.show_all()
Exemplo n.º 6
0
    def color2(self, key, text=False):

        key = 'color_' + key
        if text:
            key += '_text'

        #Make a GtkLabel
        if not text:
            label = gtk.Label(_('Background'))
        else:
            label = gtk.Label(_('Text'))

        label.set_alignment(0.0, 0.5)

        #Get a GdkColor
        color = gtk.gdk.color_parse(self.settings[key])

        #Make a GtkColorButton
        button = gtk.ColorButton(color)
        button.key = key
        button.connect('color-set', self.color_set2)

        #HBox for the two widgets
        hbox = gtk.HBox()
        hbox.pack_start(label)
        hbox.pack_end(button, False)

        #Return it
        return hbox
Exemplo n.º 7
0
 def __getColorButton(widgets, key, val, s):
     _widget = widgets.get(key)
     if _widget is None:
         _widget = gtk.ColorButton()
         _widget.set_title(s)
     _widget.set_color(gtk.gdk.color_parse(str(val)))
     return _widget
Exemplo n.º 8
0
def createColorPreference(optionVal, defaultOptionVal, enableOptionVal, label, tips, tipText):
    '''
    Create color preference box
    
    @param optionVal:
    @param defaultOptionVal:
    @param enableOptionVal:
    @param label:
    @param tips:
    @param tipText:
    '''
    o = manager.OptionManager()
    opt = o.get_default_option(optionVal, defaultOptionVal) #option,default
    
    enable = gtk.CheckButton(_('Enable'))
    enable.connect("toggled", toggleOption_cb, enableOptionVal) #enable option
    enable.set_active(o.get_default_bool_option(enableOptionVal, True)) #enable option
    cb = gtk.ColorButton(gtk.gdk.color_parse(opt))
    cb.connect("color-set", colorSet_cb, optionVal, enable) #option
    b = gtk.Button(stock=gtkconstants.STOCK_RESET_DEFAULT)
    b.connect("clicked", colorReset_cb, optionVal, defaultOptionVal, cb, enable)
    bbox = gtk.HButtonBox()
    bbox.add( cb )
    bbox.add( b )
    bbox.add( enable )
    hbox = gtk.HBox(False, 5)
    l = createLeftJustifiedLabel( label ) # label
    hbox.pack_start( l, True, True, 5 )
    hbox.pack_start( bbox, False, False, 5)
    tips.set_tip(cb,tipText) #tips
    return hbox
Exemplo n.º 9
0
def _color_clip_dialog(callback):
    dialog = gtk.Dialog(_("Create Color Clip"), None,
                        gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                        (_("Cancel").encode('utf-8'), gtk.RESPONSE_REJECT,
                         _("Create").encode('utf-8'), gtk.RESPONSE_ACCEPT))

    name_entry = gtk.Entry()
    name_entry.set_text(_("Color Clip"))

    color_button = gtk.ColorButton()

    cb_hbox = gtk.HBox(False, 0)
    cb_hbox.pack_start(color_button, False, False, 4)
    cb_hbox.pack_start(gtk.Label(), True, True, 0)

    row1 = guiutils.get_two_column_box(gtk.Label(_("Clip Name:")), name_entry,
                                       200)
    row2 = guiutils.get_two_column_box(gtk.Label(_("Select Color:")), cb_hbox,
                                       200)

    vbox = gtk.VBox(False, 2)
    vbox.pack_start(row1, False, False, 0)
    vbox.pack_start(row2, False, False, 0)
    vbox.pack_start(gtk.Label(), True, True, 0)

    align = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
    align.set_padding(12, 0, 12, 12)
    align.add(vbox)

    selection_widgets = (name_entry, color_button)

    dialog.connect('response', callback, selection_widgets)
    dialog.vbox.pack_start(align, True, True, 0)
    dialogutils.default_behaviour(dialog)
    dialog.show_all()
Exemplo n.º 10
0
    def _create_dialog(self):
        """
        Create a dialog box to enter a new tag.
        """
        # pylint: disable-msg=E1101
        if self.tag.get_handle():
            title = _('Tag: %s') % self.tag.get_name()
        else:
            title = _('New Tag')
        top = gtk.Dialog(_("%(title)s - Gramps") % {'title': title})
        top.set_default_size(300, 100)
        top.set_modal(True)
        top.set_transient_for(self.parent_window)
        top.set_has_separator(False)
        top.vbox.set_spacing(5)

        hbox = gtk.HBox()
        top.vbox.pack_start(hbox, False, False, 10)

        label = gtk.Label(_('Tag Name:'))
        self.entry = gtk.Entry()
        self.entry.set_text(self.tag.get_name())
        self.color = gtk.ColorButton()
        self.color.set_color(gtk.gdk.color_parse(self.tag.get_color()))
        title = _("%(title)s - Gramps") % {'title': _("Pick a Color")}
        self.color.set_title(title)
        hbox.pack_start(label, False, False, 5)
        hbox.pack_start(self.entry, True, True, 5)
        hbox.pack_start(self.color, False, False, 5)

        top.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
        top.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        top.show_all()
        return top
Exemplo n.º 11
0
    def color(self, human, index):

        #Make a GtkLabel
        label = gtk.Label(human)
        label.set_alignment(0.0, 0.5)

        #Get the default color
        if len(self.settings['colors']) < 12:
            self.settings['colors'] = [255, 255, 255, 127, 127, 127, 0, 0, 0, \
              255, 255, 255]

        color = self.settings['colors'][index:(index + 3)]
        color[0] *= 256
        color[1] *= 256
        color[2] *= 256
        color = gtk.gdk.Color(*color)

        #Make a GtkColorButton
        button = gtk.ColorButton(color)
        button.index = index
        button.connect('color-set', self.color_set)

        #HBox for the two widgets
        hbox = gtk.HBox()
        hbox.pack_start(label)
        hbox.pack_end(button, False)

        #Return the HBox
        return hbox
Exemplo n.º 12
0
    def _init_title(self):
        self.entry_chart_title = gtk.Entry()
        self.entry_chart_title.set_text(self.chart.title.get_text())
        self.entry_chart_title.connect("changed", self._cb_title_changed)
        label = gtk.Label("Title:")
        label.set_alignment(0.0, 0.5)
        self.attach(label, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=gtk.SHRINK)
        self.attach(self.entry_chart_title,
                    1,
                    3,
                    0,
                    1,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)

        self.color_title_chooser = gtk.ColorButton()
        self.color_title_chooser.set_color(self.chart.title.get_color())
        self.color_title_chooser.connect("color-set",
                                         self._cb_title_color_changed)
        label = gtk.Label("Title color:")
        label.set_alignment(0.0, 0.5)
        self.attach(label, 0, 1, 1, 2, xoptions=gtk.FILL, yoptions=gtk.SHRINK)
        self.attach(self.color_title_chooser,
                    1,
                    3,
                    1,
                    2,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)

        self.title_visible = gtk.CheckButton("Show title")
        self.title_visible.set_active(self.chart.title.get_visible())
        self.title_visible.connect("toggled", self._cb_title_visible_changed)
        self.attach(self.title_visible,
                    0,
                    3,
                    2,
                    3,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)

        self.title_antialias = gtk.CheckButton("Antialias title")
        self.title_antialias.set_active(self.chart.title.get_antialias())
        self.title_antialias.connect("toggled",
                                     self._cb_title_antialias_changed)
        self.attach(self.title_antialias,
                    0,
                    3,
                    3,
                    4,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)

        self.attach(gtk.HSeparator(),
                    0,
                    3,
                    4,
                    5,
                    xoptions=gtk.EXPAND | gtk.FILL,
                    yoptions=gtk.SHRINK)
Exemplo n.º 13
0
    def create_ui(self):
        vbox = gtk.VBox()
        self.vbox.add(vbox)

        interface_vbox = gtk.VBox()
        self.custom_widgets_checkbutton = gtk.CheckButton('Use custom widgets')
        self.custom_widgets_checkbutton.set_active(
            self.app.gui_factory.get_use_custom_widgets())
        self.custom_widgets_checkbutton.connect('toggled',
                                                self.on_custom_widget_toggled)
        interface_vbox.pack_start(self.custom_widgets_checkbutton)

        self.vumeter_color_checkbutton = gtk.CheckButton(
            'Use custom vumeter color')
        self.vumeter_color_checkbutton.set_active(
            self.app.gui_factory.get_vumeter_color_scheme() == 'solid')
        self.vumeter_color_checkbutton.connect('toggled',
                                               self.on_vumeter_color_change)
        interface_vbox.pack_start(self.vumeter_color_checkbutton)
        hbox = gtk.HBox()
        interface_vbox.pack_start(hbox)
        self.custom_color_box = hbox
        self.custom_color_box.set_sensitive(
            self.vumeter_color_checkbutton.get_active() == True)
        hbox.pack_start(gtk.Label('Custom color:'))
        self.vumeter_color_picker = gtk.ColorButton()
        self.vumeter_color_picker.set_color(
            gtk.gdk.color_parse(self.app.gui_factory.get_vumeter_color()))
        self.vumeter_color_picker.connect('color-set',
                                          self.on_vumeter_color_change)
        hbox.pack_start(self.vumeter_color_picker)

        self.minimize_to_tray_checkbutton = gtk.CheckButton(
            'Minimize to system tray')
        self.minimize_to_tray_checkbutton.set_active(
            self.app.gui_factory.get_minimize_to_tray())
        self.minimize_to_tray_checkbutton.connect(
            'toggled', self.on_minimize_to_tray_toggled)
        interface_vbox.pack_start(self.minimize_to_tray_checkbutton)

        vbox.pack_start(self.create_frame('Interface', interface_vbox))

        table = gtk.Table(2, 2, False)
        table.set_row_spacings(5)
        table.set_col_spacings(5)

        table.attach(gtk.Label('Meter scale'), 0, 1, 0, 1)
        self.meter_scale_combo = self.create_meter_store_and_combo()
        table.attach(self.meter_scale_combo, 1, 2, 0, 1)

        table.attach(gtk.Label('Slider scale'), 0, 1, 1, 2)
        self.slider_scale_combo = self.create_slider_store_and_combo()
        table.attach(self.slider_scale_combo, 1, 2, 1, 2)

        vbox.pack_start(self.create_frame('Scales', table))

        self.vbox.show_all()

        self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
Exemplo n.º 14
0
 def create_widgets(self):
     Edit.create_widgets(self)
     self.color_button = gtk.ColorButton()
     self.color_button.connect("color-set", self.on_widget_changed)
     self.color_child = self.color_button.get_child()
     self.ambiguous_label = gtk.Label(str(ambiguous))
     self.ambiguous_label.show_all()
     self.data_widget = self.color_button
Exemplo n.º 15
0
 def get_box_from_colour(self, colour):
     """Turn a colour array into a colour widget"""
     result = gtk.ColorButton(gtk.gdk.Color(
         int(colour[0]*65535), int(colour[1]*65535), int(colour[2]*65535)))
     result.set_use_alpha(True)
     result.set_alpha(int(colour[3]*65535))
     result.connect("color-set", self.has_changed)
     return result
Exemplo n.º 16
0
    def _Init(self):
        StockSetting._Init(self)
        self.Button = gtk.ColorButton()
        self.Button.set_size_request(100, -1)
        self.Button.set_use_alpha(True)
        self.Button.connect('color-set', self.Changed)

        self.Widget = gtk.Alignment(1, 0.5)
        self.Widget.add(self.Button)
        self.Box.pack_start(self.Widget, True, True)
Exemplo n.º 17
0
    def new_tag(self, *p):
        """Enter a new tag.
        """
        d = gtk.Dialog(title=_("New tag name"),
                       parent=None,
                       flags=gtk.DIALOG_DESTROY_WITH_PARENT,
                       buttons=(
                           gtk.STOCK_CANCEL,
                           gtk.RESPONSE_CANCEL,
                           gtk.STOCK_OK,
                           gtk.RESPONSE_OK,
                       ))
        l = gtk.Label(_("Enter a new tag name and select its color."))
        d.vbox.pack_start(l, expand=False)

        hb = gtk.HBox()
        hb.pack_start(gtk.Label(_("Name")), expand=False)
        tagname = gtk.Entry()
        hb.pack_start(tagname, expand=False)
        d.vbox.pack_start(hb, expand=False)

        hb = gtk.HBox()
        hb.pack_start(gtk.Label(_("Color")), expand=False)
        colorbutton = gtk.ColorButton()
        colorbutton.set_color(gtk.gdk.color_parse('red'))
        hb.pack_start(colorbutton, expand=False)
        d.vbox.pack_start(hb, expand=False)

        d.connect('key-press-event', dialog.dialog_keypressed_cb)
        d.show_all()
        dialog.center_on_mouse(d)

        res = d.run()
        ret = None
        if res == gtk.RESPONSE_OK:
            try:
                tag = unicode(tagname.get_text())
            except ValueError:
                tag = None
            color = colorbutton.get_color()
        else:
            tag = None
        d.destroy()

        if tag and not tag in self.tags:
            if not re.match('^[\w\d_]+$', tag):
                dialog.message_dialog(_("The tag contains invalid characters"),
                                      icon=gtk.MESSAGE_ERROR)
                return True
            self.tags.append(tag)
            self.controller.package._tag_colors[tag] = "#%04x%04x%04x" % (
                color.red, color.green, color.blue)
            self.controller.notify('TagUpdate', tag=tag)
            self.refresh()
        return True
Exemplo n.º 18
0
    def __init__(self, figure, openbutton):
        _gtk.Window.__init__(self)  #, gtk.WINDOW_POPUP)
        self.set_resizable(False)
        self.set_title('Lights')
        self.figure = figure
        self.openbutton = openbutton

        table = _gtk.Table(6, 4, True)
        self.chooser = _gtk.combo_box_new_text()
        for i in range(8):
            self.chooser.append_text(str(i))
        self.chooser.connect("changed", self.on_choose_light)
        table.attach(self.chooser, 0, 1, 0, 1)

        for i, txt in enumerate(
            ('position', 'ambient', 'diffuse', 'specular', 'color')):
            lab = _gtk.Label(txt)
            lab.set_alignment(1, 0.5)
            table.attach(lab, 0, 1, 1 + i, 2 + i)
        self.cb_on = _gtk.CheckButton('On')
        self.cb_on.connect("toggled", self.on_set_bool, "isOn")
        table.attach(self.cb_on, 1, 2, 0, 1)
        self.cb_cam = _gtk.CheckButton('Camlight')
        self.cb_cam.connect("toggled", self.on_set_bool, "isCamLight")
        table.attach(self.cb_cam, 2, 3, 0,
                     1)  # Should be able to do 2,4, but this messes up prev cb

        self.sb_pos = [
            _gtk.SpinButton(_gtk.Adjustment(0, -10, 10, 0.1, 1), digits=1)
            for i in range(4)
        ]
        hbox = _gtk.HBox()
        for sb in self.sb_pos:
            sb.connect("value-changed", self.on_change_position)
            hbox.pack_start(sb)
        table.attach(hbox, 1, 4, 1, 2)

        self.sliders = [(val, _gtk.HScale(_gtk.Adjustment(0, 0, 1, 0.01, 0.1)))
                        for val in ('ambient', 'diffuse', 'specular')]
        for i, (val, slider) in enumerate(self.sliders):
            slider.set_digits(2)
            slider.set_value_pos(_gtk.POS_RIGHT)
            slider.connect("value-changed", self.on_change_intensity, val)
            table.attach(slider, 1, 4, 2 + i, 3 + i)

        box = _gtk.HBox()
        self.color = _gtk.ColorButton()
        self.color.connect("color-set", self.on_change_color)
        box.pack_start(self.color, False, False)
        table.attach(box, 1, 4, 5, 6)

        table.show_all()
        self.add(table)

        self.connect('delete-event', self.on_delete)
Exemplo n.º 19
0
    def __init__(self, sheriff_gtk, parent):
        # add command dialog
        gtk.Dialog.__init__(
            self,
            "Preferences",
            parent,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL,
             gtk.RESPONSE_REJECT),
        )
        table = gtk.Table(4, 2)

        # console rate limit
        table.attach(gtk.Label("Console rate limit (kB/s)"), 0, 1, 0, 1, 0, 0)
        self.rate_limit_sb = gtk.SpinButton()
        self.rate_limit_sb.set_digits(0)
        self.rate_limit_sb.set_increments(1, 1000)
        self.rate_limit_sb.set_range(0, 999999)
        self.rate_limit_sb.set_value(
            sheriff_gtk.cmd_console.get_output_rate_limit())

        table.attach(self.rate_limit_sb, 1, 2, 0, 1)

        # background color
        table.attach(gtk.Label("Console background color"), 0, 1, 1, 2, 0, 0)
        self.bg_color_bt = gtk.ColorButton(
            sheriff_gtk.cmd_console.get_background_color())
        table.attach(self.bg_color_bt, 1, 2, 1, 2)

        # foreground color
        table.attach(gtk.Label("Console text color"), 0, 1, 2, 3, 0, 0)
        self.text_color_bt = gtk.ColorButton(
            sheriff_gtk.cmd_console.get_text_color())
        table.attach(self.text_color_bt, 1, 2, 2, 3)

        # font
        table.attach(gtk.Label("Console font"), 0, 1, 3, 4, 0, 0)
        self.font_bt = gtk.FontButton(sheriff_gtk.cmd_console.get_font())
        table.attach(self.font_bt, 1, 2, 3, 4)

        self.vbox.pack_start(table, False, False, 0)
        table.show_all()
Exemplo n.º 20
0
def _get_color_selector(editable_property):
    gdk_color = editable_property.get_value_as_gdk_color()
    color_button = gtk.ColorButton(gdk_color)
    color_button.connect("color-set", editable_property.color_selected)

    hbox = gtk.HBox(False, 4)
    hbox.pack_start(color_button, False, False, 4)
    hbox.pack_start(gtk.Label(), True, True, 0)

    return _get_two_column_editor_row(editable_property.get_display_name(),
                                      hbox)
Exemplo n.º 21
0
    def build_appearance(self):
        vbox = gtk.VBox(False, 2)

        vbox.pack_start(self.make_sb("noticere", gtk.Entry()), 0, 0, 0)
        vbox.pack_start(self.make_sb("ignorere", gtk.Entry()), 0, 0, 0)

        vbox.pack_start(self.make_sb("incomingcolor", gtk.ColorButton()), 0, 0,
                        0)
        vbox.pack_start(self.make_sb("outgoingcolor", gtk.ColorButton()), 0, 0,
                        0)
        vbox.pack_start(self.make_sb("noticecolor", gtk.ColorButton()), 0, 0,
                        0)
        vbox.pack_start(self.make_sb("ignorecolor", gtk.ColorButton()), 0, 0,
                        0)
        vbox.pack_start(self.make_sb("callsigncolor", gtk.ColorButton()), 0, 0,
                        0)
        vbox.pack_start(self.make_sb("brokencolor", gtk.ColorButton()), 0, 0,
                        0)

        vbox.pack_start(self.make_sb("eolstrip", self.make_bool()), 0, 0, 0)

        vbox.pack_start(self.make_sb("font", gtk.FontButton()), 0, 0, 0)
        vbox.pack_start(
            self.make_sb("scrollback", self.make_spin(128, 0, 10000)), 0, 0, 0)

        vbox.show()
        return vbox
Exemplo n.º 22
0
    def __init__(self, session):
        """constructor
        """
        BaseTable.__init__(self, 5, 1)
        self.set_border_width(5)
        self.session = session

        ContactList = extension.get_default('contact list')

        self.session.config.get_or_set('adium_theme', 'renkoo')

        cb_override_text_color = self.create_check(
            _('Override incoming text color'),
            'session.config.b_override_text_color')
        self.session.config.subscribe(self._on_cb_override_text_color_toggled,
                                      'b_override_text_color')

        def on_color_selected(cb):
            col = cb.get_color()
            col_e3 = e3.base.Color(col.red, col.green, col.blue)
            self.set_attr('session.config.override_text_color',
                          '#' + col_e3.to_hex())

        self.b_text_color = gtk.ColorButton(color=gtk.gdk.color_parse(
            self.get_attr('session.config.override_text_color')))
        self.b_text_color.set_use_alpha(False)
        self.b_text_color.connect('color-set', on_color_selected)
        h_color_box = gtk.HBox()
        h_color_box.pack_start(cb_override_text_color)
        h_color_box.pack_start(self.b_text_color)

        self.append_row(h_color_box)
        #update ColorButton sensitive
        self._on_cb_override_text_color_toggled(
            self.session.config.get_or_set('b_override_text_color', False))

        self.append_combo(_('Image theme'), gui.theme.get_image_themes,
                          'session.config.image_theme')
        self.append_combo(_('Sound theme'), gui.theme.get_sound_themes,
                          'session.config.sound_theme')
        self.append_combo(_('Emote theme'), gui.theme.get_emote_themes,
                          'session.config.emote_theme')
        self.append_combo(_('Adium theme'), gui.theme.get_adium_themes,
                          'session.config.adium_theme')
        self.append_entry_default(_('Nick format'), 'nick',
                                  'session.config.nick_template_clist',
                                  ContactList.NICK_TPL)
        self.append_entry_default(_('Group format'), 'group',
                                  'session.config.group_template',
                                  ContactList.GROUP_TPL)

        self.add_button(_('Apply'), 0, 7, self.on_redraw_main_screen, 0, 0)
Exemplo n.º 23
0
 def _init_color(self):
     self.color_chooser = gtk.ColorButton()
     self.color_chooser.connect("color-set", self._cb_area_color_changed)
     label = gtk.Label("Area color:")
     label.set_alignment(0.0, 0.5)
     self.attach(label, 0, 1, 6, 7, xoptions=gtk.FILL, yoptions=gtk.SHRINK)
     self.attach(self.color_chooser,
                 1,
                 2,
                 6,
                 7,
                 xoptions=gtk.EXPAND | gtk.FILL,
                 yoptions=gtk.SHRINK)
	def __init__(self):
		super(WeatherWW, self).__init__()
		self.set_title("Weather Widget")

		self.label_color = gtk.Label("Text color:")
		self.form_color = gtk.ColorButton()
		self.form_color.set_color(gtk.gdk.color_parse("#0000FFFF0000"))

		self.label_size = gtk.Label("Text size:")
		self.form_size = gtk.SpinButton(adjustment = gtk.Adjustment(12.0, 2.0, 512.0, 1.0, 10.0, 0.0), digits = 0)

		self.label_font = gtk.Label("Font:")
		self.form_font = gtk.Entry()
		self.form_font.set_text("Sawasdee")

		self.label_update = gtk.Label("Update timer:")
		self.form_update = gtk.SpinButton(adjustment = gtk.Adjustment(1.0, 0.1, 60.0, 0.1, 1.0, 0.0), digits = 1)

		self.label_zip = gtk.Label("Zip code (for weather):")
		self.form_zip = gtk.Entry()
		self.form_zip.set_text("02492")

		self.table.attach(self.label_path, 0, 2, 0, 1)
		self.table.attach(self.form_path, 2, 4, 0, 1)
		self.table.attach(self.label_pos, 0, 2, 1, 2)
		self.table.attach(self.form_pos_x, 2, 3, 1, 2)
		self.table.attach(self.form_pos_y, 3, 4, 1, 2)
		self.table.attach(self.label_alpha, 0, 2, 2, 3)
		self.table.attach(self.form_alpha, 2, 4, 2, 3)
		self.table.attach(self.label_angle, 0, 2, 3, 4)
		self.table.attach(self.form_angle, 2, 4, 3, 4)
		self.table.attach(self.label_color, 0, 2, 4, 5)
		self.table.attach(self.form_color, 2, 4, 4, 5)
		self.table.attach(self.label_size, 0, 2, 5, 6)
		self.table.attach(self.form_size, 2, 4, 5, 6)
		self.table.attach(self.label_font, 0, 2, 6, 7)
		self.table.attach(self.form_font, 2, 4, 6, 7)
		self.table.attach(self.label_update, 0, 2, 7, 8)
		self.table.attach(self.form_update, 2, 4, 7, 8)
		self.table.attach(self.label_zip, 0, 2, 8, 9)
		self.table.attach(self.form_zip, 2, 4, 8, 9)
		self.table.attach(self.label_link, 0, 2, 9, 10)
		self.table.attach(self.form_link, 2, 4, 9, 10)
		self.table.attach(self.label_process, 0, 2, 10, 11)
		self.table.attach(self.form_process, 2, 4, 10, 11)
		self.table.attach(self.label_args, 0, 2, 11, 12)
		self.table.attach(self.form_args, 2, 4, 11, 12)
		self.table.attach(self.button_preview, 0, 4, 12, 13)
		self.table.attach(self.button_go, 0, 4, 13, 14)
		self.add(self.table)
		self.show_all()
Exemplo n.º 25
0
def get_fade_panel(fade_data):
    type_combo_box = gtk.combo_box_new_text()
    type_combo_box.append_text(_("Fade In"))
    type_combo_box.append_text(_("Fade Out"))
    type_combo_box.set_active(0)

    type_row = get_two_column_box(gtk.Label(_("Type:")), type_combo_box)

    color_button = gtk.ColorButton(gtk.gdk.Color(0.0, 0.0, 0.0))
    color_button_box = guiutils.get_left_justified_box([color_button])
    color_label = gtk.Label(_("Color:"))
    color_row = get_two_column_box(color_label, color_button_box)

    length_entry = gtk.Entry()
    length_entry.set_text(str(30))
    length_row = get_two_column_box(gtk.Label(_("Length:")), length_entry)

    # Encoding widgets
    encodings_cb = gtk.combo_box_new_text()
    for encoding in renderconsumer.encoding_options:
        encodings_cb.append_text(encoding.name)
    encodings_cb.set_active(0)

    quality_cb = gtk.combo_box_new_text()
    transition_widgets = (encodings_cb, quality_cb)
    encodings_cb.connect(
        "changed",
        lambda w, e: _transition_encoding_changed(transition_widgets), None)
    _fill_transition_quality_combo_box(transition_widgets)

    # Build panel
    edit_vbox = gtk.VBox(False, 2)
    edit_vbox.pack_start(type_row, False, False, 0)
    edit_vbox.pack_start(length_row, False, False, 0)
    edit_vbox.pack_start(color_row, False, False, 0)

    enconding_vbox = gtk.VBox(False, 2)
    enconding_vbox.pack_start(encodings_cb, False, False, 0)
    enconding_vbox.pack_start(quality_cb, False, False, 0)

    vbox = gtk.VBox(False, 2)
    vbox.pack_start(get_named_frame(_("Transition Options"), edit_vbox))
    vbox.pack_start(get_named_frame(_("Encoding"), enconding_vbox))

    alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
    alignment.set_padding(12, 24, 12, 12)
    alignment.add(vbox)
    return (alignment, type_combo_box, length_entry, encodings_cb, quality_cb,
            color_button)
Exemplo n.º 26
0
 def __init__(self):
     window = gtk.Window()
     window.connect('destroy', lambda w: gtk.main_quit())
     hbox = gtk.HBox()
     window.add(hbox)
     label = gtk.Label('Foreground Color:')
     hbox.pack_start(label, False)
     colorbutton = gtk.ColorButton(gtk.gdk.color_parse('red'))
     colorbutton.set_use_alpha(True)
     colorbutton.set_title('Select a Color')
     colorbutton.set_alpha(32767)
     colorbutton.connect('color-set', self.color_set_cb)
     hbox.pack_start(colorbutton)
     window.show_all()
     return
Exemplo n.º 27
0
        def __init__(self, option):
            """
            Constructor.
            
            @param cb: An instance of the application class.
            @type cb: pida.main.Application

            @param section: The configuration section that the widget is for.
            @type section: string

            @param key: The configuration key that the widget is for
            @type key: string
            """
            widget = gtk.ColorButton()
            registry_widget.__init__(self, widget, option)
Exemplo n.º 28
0
    def register_color_setting(self, name, label, weight=100):
        if name in self._color_settings:
            self.log.debug("Tried to register color '%s' twice", name)
            return

        def get_color_wrapper(obj):
            def gtk_color_to_dict():
                gtk_color = obj.get_color()
                alpha = obj.get_alpha()
                return {
                    "red": gtk_color.red / GTK_COLOR_MAX,
                    "green": gtk_color.green / GTK_COLOR_MAX,
                    "blue": gtk_color.blue / GTK_COLOR_MAX,
                    "alpha": alpha / GTK_COLOR_MAX
                }

            return gtk_color_to_dict

        def set_color_wrapper(obj):
            def set_gtk_color_by_dict(color):
                obj.set_color(
                    gtk.gdk.Color(int(color["red"] * GTK_COLOR_MAX),
                                  int(color["green"] * GTK_COLOR_MAX),
                                  int(color["blue"] * GTK_COLOR_MAX)))
                obj.set_alpha(int(color["alpha"] * GTK_COLOR_MAX))

            return set_gtk_color_by_dict

        widget = gtk.ColorButton()
        widget.set_use_alpha(True)
        wrappers = (get_color_wrapper(widget), set_color_wrapper(widget))
        self._color_settings[name] = {
            "name": name,
            "label": label,
            "weight": weight,
            "widget": widget,
            "wrappers": wrappers
        }
        widget.connect(
            "color-set",
            lambda widget: self.core.emit_event("visual-item-updated"))
        self.core.add_item(name, *wrappers)
        self.register_state_item("settings/view/colors/%s" % name, *wrappers)
        self._rebuild_color_settings()
Exemplo n.º 29
0
 def __init__(self, icon_name='color-preview', **kwargs):
     self._accelerator = None
     self._tooltip = None
     #self._palette_invoker = ToolInvoker()
     self._palette = None
     gobject.GObject.__init__(self, **kwargs)
     # The gtk.ToolButton has already added a normal button.
     # Replace it with a ColorButton
     color_button = gtk.ColorButton()
     self.add(color_button)
     # The following is so that the behaviour on the toolbar is correct.
     color_button.set_relief(gtk.RELIEF_NONE)
     color_button.icon_size = gtk.ICON_SIZE_LARGE_TOOLBAR
     #self._palette_invoker.attach_tool(self)
     # This widget just proxies the following properties to the colorbutton
     color_button.connect('notify::color', self.__notify_change)
     color_button.connect('notify::icon-name', self.__notify_change)
     color_button.connect('notify::icon-size', self.__notify_change)
     color_button.connect('notify::title', self.__notify_change)
     color_button.connect('color-set', self.__color_set_cb)
     color_button.connect('can-activate-accel',  self.__button_can_activate_accel_cb)
Exemplo n.º 30
0
    def __init__(self, name, value, type, plugin):
        super(OptionBox, self).__init__()
        global main_window

        self.label = gtk.Label(name)
        self.value = gtk.Entry()

        self.popup = None

        self.type = type
        self.m_name = name
        self.plugin = plugin

        if type == config.OptionTypePlain:
            self.value.set_text(value)
        else:
            if type == config.OptionTypeColor:
                (r, g, b) = get_rgb_from_string(value)
                self.value = gtk.ColorButton(gtk.gdk.Color(r, g, b))
                self.value.set_use_alpha(False)
                self.value.connect("color-set", self.on_new_color)

            else:
                self.value = gtk.Button(value)
                self.value.connect("clicked", self.on_clicked)

                if type == config.OptionTypeKey:
                    self.popup = widgets.KeyGrab(main_window)

                if type == config.OptionTypeButton:
                    self.popup = widgets.ButtonSelect(main_window)

        self.label.set_justify(gtk.JUSTIFY_FILL)
        self.add(self.label)
        self.add(self.value)
        self.set_homogeneous(True)

        self.show_all()