Beispiel #1
0
 def __init__(self, value, metadata, set_value, hook, arg_str=None):
     super(RawValueWidget, self).__init__(homogeneous=False, spacing=0)
     self.value = value
     self.metadata = metadata
     self.set_value = set_value
     self.hook = hook
     self.entry = gtk.Entry()
     insensitive_colour = gtk.Style().bg[0]
     self.entry.modify_bg(gtk.STATE_INSENSITIVE, insensitive_colour)
     self.normal_colour = gtk.Style().fg[gtk.STATE_NORMAL]
     if rose.env.contains_env_var(self.value):
         self.entry.modify_text(gtk.STATE_NORMAL, ENV_COLOUR)
         self.entry.set_tooltip_text(rose.config_editor.VAR_WIDGET_ENV_INFO)
     self.entry.set_text(self.value)
     self.entry.connect("button-release-event",
                        self._handle_middle_click_paste)
     self.entry.connect_after("paste-clipboard", self.setter)
     self.entry.connect_after("key-release-event",
                              lambda e, v: self.setter(e))
     self.entry.connect_after("button-release-event",
                              lambda e, v: self.setter(e))
     self.entry.show()
     self.pack_start(self.entry, expand=True, fill=True, padding=0)
     self.entry.connect('focus-in-event', self.hook.trigger_scroll)
     self.grab_focus = lambda: self.hook.get_focus(self.entry)
    def __init__(self):
        gtk.GenericCellRenderer.__init__(self)
        self.height = 0
        self.data = None

        font = gtk.Style().font_desc
        self.default_size = font.get_size() / pango.SCALE

        self.labels = graphics.Sprite()

        self.date_label = graphics.Label(size=self.default_size)

        self.interval_label = graphics.Label(size=self.default_size)
        self.labels.add_child(self.interval_label)

        self.activity_label = graphics.Label(size=self.default_size)
        self.labels.add_child(self.activity_label)

        self.category_label = graphics.Label(size=self.default_size)
        self.labels.add_child(self.category_label)

        self.description_label = graphics.Label(size=self.default_size)
        self.labels.add_child(self.description_label)

        self.duration_label = graphics.Label(size=self.default_size)
        self.labels.add_child(self.duration_label)

        default_font = gtk.Style().font_desc.to_string()

        self.selected_color = None
        self.normal_color = None

        self.col_padding = 10
        self.row_padding = 4
Beispiel #3
0
 def set_gtk_color_style(self, widget, red, green, blue):
     style = gtk.Style()
     colormap = gtk.gdk.colormap_get_system()
     #print colormap
     color = colormap.alloc_color(red,green,blue,writeable=True)
     widget.modify_fg(gtk.STATE_NORMAL, color)
     widget.set_style(style)
Beispiel #4
0
    def __init__(self, text, icon=None, **kwargs):
        graphics.Sprite.__init__(self, interactive=True, **kwargs)

        self._style = gtk.MenuItem().rc_get_style()

        self.font_desc = pango.FontDescription(
            gtk.Style().font_desc.to_string())
        self.font_desc.set_size(12 * pango.SCALE)

        self.fill = self._style.bg[gtk.STATE_NORMAL]
        self.over = self._style.bg[gtk.STATE_SELECTED]
        self.out = self._style.bg[gtk.STATE_NORMAL]
        self.text_color = self._style.text[gtk.STATE_NORMAL]
        self.width = 120
        self.height = 24

        self.icon_sprite = graphics.Icon(icon)
        self.add_child(self.icon_sprite)

        self.label_sprite = graphics.Label(text, color=self.text_color, x=26)
        self.add_child(self.label_sprite)
        self._over = False
        self._clicked = False

        self.connect("on-mouse-over", self.on_mouse_over)
        self.connect("on-mouse-out", self.on_mouse_out)
        self.connect('on-click', self.on_button_press_event)
        self.connect("on-render", self.on_render)
Beispiel #5
0
    def __init__(self, tagtable=None):
        VView.__init__(self)
        self.textview = gtk.TextView()
        self.textview.connect("populate_popup", self.vwGetPopup)
        self.add(self.textview)

        if tagtable == None:
            tagtable = gtk.TextTagTable()

        self.vwSetTagTable(tagtable)

        style = gtk.Style()

        style.base[gtk.STATE_NORMAL] = gdk.Color(0, 0, 0)
        style.text[gtk.STATE_NORMAL] = gdk.Color(0, 0, 0xff)

        style.base[gtk.STATE_INSENSITIVE] = gdk.Color(0, 0, 0)
        style.text[gtk.STATE_INSENSITIVE] = gdk.Color(20, 20, 20)

        self.textview.set_style(style)

        self.tagcfg = ConfigParser()

        self.curtag = None  # Is a current tag selected?
        #self.deftag =
        self.vwInitTag(VTextTag("default"))

        start, end = self.textbuf.get_bounds()
        self.textbuf.create_mark("insertend", end)
Beispiel #6
0
    def load_pixbuf(self):
        if not self.name:
            print 'Error: No icon specified.'
            return
        if not self.size:
            print 'Note: No icon size specified.'

        def render_icon(icon_set, name, size):
            self.pixbuf = icon_set.render_icon(
                style,
                gtk.TEXT_DIR_NONE,
                gtk.STATE_NORMAL,
                self.size or gtk.ICON_SIZE_BUTTON,
                gtk.Image(),
                None)
            return

        style = gtk.Style()
        icon_set = style.lookup_icon_set(self.name)

        if not icon_set:
            t = gtk.icon_theme_get_default()
            self.pixbuf = t.lookup_icon(self.name, self.size, 0).load_icon()
        else:
            icon_set = style.lookup_icon_set(self.name)
            render_icon(icon_set, self.name, self.size)

        if not self.pixbuf:
            print 'Error: No name failed to match any installed icon set.'
            self.name = gtk.STOCK_MISSING_IMAGE
            icon_set = style.lookup_icon_set(self.name)
            render_icon(icon_set, self.name, self.size)
        return
Beispiel #7
0
 def __init__(self, variable, var_ops, is_ghost=False, show_modes=None):
     self.variable = variable
     self.key = variable.name
     self.value = variable.value
     self.meta = variable.metadata
     self.is_ghost = is_ghost
     self.var_ops = var_ops
     if show_modes is None:
         show_modes = {}
     self.show_modes = show_modes
     self.insensitive_colour = gtk.Style().bg[0]
     self.bad_colour = rose.gtk.util.color_parse(
         rose.config_editor.COLOUR_VARIABLE_TEXT_ERROR)
     self.hidden_colour = rose.gtk.util.color_parse(
         rose.config_editor.COLOUR_VARIABLE_TEXT_IRRELEVANT)
     self.keywidget = self.get_keywidget(variable, show_modes)
     self.generate_valuewidget(variable)
     self.is_inconsistent = False
     if 'type' in variable.error:
         self._set_inconsistent(self.valuewidget, variable)
     self.errors = variable.error.keys()
     self.menuwidget = self.get_menuwidget(variable)
     self.generate_labelwidget()
     self.generate_contentwidget()
     self.yoptions = gtk.FILL
     self.force_signal_ids = []
     self.is_modified = False
     for child_widget in self.get_children():
         setattr(child_widget, 'get_parent', lambda: self)
     self.trigger_ignored = lambda v, b: b
     self.get_parent = lambda: None
     self.is_ignored = False
     self.set_ignored()
     self.update_status()
Beispiel #8
0
    def __init__(self, show_selection=False):
        gtk.TreeView.__init__(self)

        self.set_headers_visible(False)
        self.set_show_expanders(False)
        self.show_selection = show_selection

        # fact (None for parent), duration, parent data (if any)
        self.store_model = gtk.ListStore(gobject.TYPE_PYOBJECT)
        self.set_model(self.store_model)

        toggle_cell = gtk.CellRendererToggle()
        toggle_cell.set_property('activatable', True)
        toggle_cell.connect('toggled', self._on_toggle_clicked,
                            self.store_model)

        self.toggle_column = gtk.TreeViewColumn(_("Export to RT"), toggle_cell)
        self.toggle_column.set_cell_data_func(toggle_cell, action_toggle)
        self.toggle_column.set_visible(self.show_selection)
        self.append_column(self.toggle_column)

        fact_cell = FactCellRenderer()
        fact_column = gtk.TreeViewColumn("", fact_cell, data=0)
        fact_column.set_cell_data_func(fact_cell, parent_painter)
        fact_column.set_expand(True)
        self.append_column(fact_column)

        edit_cell = gtk.CellRendererPixbuf()
        edit_cell.set_property("ypad", 2)
        edit_cell.set_property("mode", gtk.CELL_RENDERER_MODE_ACTIVATABLE)
        self.edit_column = gtk.TreeViewColumn("", edit_cell)
        self.edit_column.set_cell_data_func(edit_cell, action_painter)
        self.append_column(self.edit_column)

        self.connect("row-activated", self._on_row_activated)
        self.connect("button-release-event", self._on_button_release_event)
        self.connect("key-release-event", self._on_key_released)
        self.connect("configure-event", lambda *args: self.fix_row_heights())
        self.connect("motion-notify-event", self._on_motion)

        self.show()

        self.longest_activity_category = 0  # we will need this for the cell renderer
        self.longest_interval = 0  # we will need this for the cell renderer
        self.longest_duration = 0  # we will need this for the cell renderer
        self.stored_selection = []

        self.box = None

        pixmap = gtk.gdk.Pixmap(None, 10, 10, 1)
        _test_context = pixmap.cairo_create()
        self._test_layout = _test_context.create_layout()
        font = pango.FontDescription(gtk.Style().font_desc.to_string())
        self._test_layout.set_font_description(font)
        self.prev_rows = []
        self.new_rows = []

        self.connect("destroy", self.on_destroy)
Beispiel #9
0
def print_text(context,
               text="",
               rect={
                   'x': 0,
                   'y': 0,
                   'w': 1,
                   'h': 1
               },
               font="",
               font_name="",
               font_style="",
               font_size=None,
               align=TOP_LEFT,
               border=4,
               letter_spacing=[(0, 0)],
               scale=0):
    """
    print_text(context, text, rect,font,font_name,font_style, font_size,align, border, letter_spacing)

    context is cairo.Context
    text is any types
    rect is dict type {'x': int, 'y': int, 'w': int, 'h': int}
    font is string font description, example:'Ubuntu Normal 10' -- Ubuntu - font name,
                                                                   Normal - style,
                                                                   10-size
    if font != "" then font_name,font_style,font_size do not used!
    font_name is string
    font_style is string
    font_size is int
    align is int see align types
    border is int border size
    letter_spacing is list of tuple letter_spacing size,example: letter_spacing=[(2,3)(5,5)(10,0)]
                                                                 after the 2nd character letter spacing is 5
                                                                 after the 5th character letter spacing is 5
                                                                 after the 10th character letter spacing reset to 0
    """
    context.save()
    font = font or " ".join([font_name, font_style,
                             str(font_size)
                             ]) or gtk.Style().font_desc.to_string()
    layout = pangocairo.CairoContext.create_layout(context)
    desc = pango.FontDescription(font)
    layout.set_font_description(desc)
    attr_list = pango.AttrList()
    if len(letter_spacing):
        for i in letter_spacing:
            attr = pango.AttrLetterSpacing(int(i[1] * pango.SCALE), i[0],
                                           len(text))
            attr_list.insert(attr)
    layout.set_attributes(attr_list)
    layout.set_markup(str(text))
    pangocairo.CairoContext.update_layout(context, layout)
    lw, lh = layout.get_size()
    lw /= pango.SCALE
    lh /= pango.SCALE
    context_align(context, rect, align, lw, lh, border)
    pangocairo.CairoContext.show_layout(context, layout)
    context.restore()
Beispiel #10
0
    def on_render(self, sprite):
        #TODO make colors configurable
        if self.status == self.TO_BE_PAID:
            self.fill = '#008000'
        elif self.status == self.OVERDUE:
            self.fill = '#ff0000'
        elif self.status == self.PAID:
            self.fill =  '#b3b3b3'

        self.move_to_default_position()

        if self.multi:
            self.graphics.rectangle(2.5, 2.5, self.parent.item_width - 5,
                                    int(self.parent._font_height * 1.8) + 2,
                                    corner_radius=7)
            self.graphics.fill_stroke(self.fill, '#fff', self.line_width)

        self.graphics.rectangle(0.5, 0.5, self.parent.item_width - 6,
                                int(self.parent._font_height * 1.8),
                                corner_radius=5)
        self.graphics.fill_stroke(self.fill, '#fff', self.line_width)
        self.graphics.circle(7.5, 7.5, 3)
        self.graphics.fill_stroke((self.bullet_color if self.bullet_color else
                                   self.parent.style.text[self.parent.state]),
                                   self.parent.style.base[self.parent.state],
                                   self.line_width)

        self.rectangle.width = self.parent.item_width - 1
        self.rectangle.height = int(self.parent._font_height * 1.8) + 5

        if self.parent.item_width >= 52:
            self.style = gtk.Style()
            size = self.style.font_desc.get_size() / pango.SCALE
            family = self.style.font_desc.get_family()
            fontstyle = self.style.font_desc.get_style()
            weight = self.style.font_desc.get_weight()

            self.payee_label.font_desc.set_size((size - 1) * pango.SCALE)
            self.payee_label.font_desc.set_family(family)
            self.payee_label.font_desc.set_style(fontstyle)
            self.payee_label.font_desc.set_weight(weight)
            self.payee_label.max_width = self.parent.item_width - 22
            self.payee_label.text = self.payee

            self.amount_label.font_desc.set_size((size - 2) * pango.SCALE)
            self.amount_label.font_desc.set_family(family)
            self.amount_label.font_desc.set_style(fontstyle)
            self.amount_label.font_desc.set_weight(weight)
            self.amount_label.y = self.parent._font_height * 0.9
            self.amount_label.max_width = self.parent.item_width - 12
            self.amount_label.text = self.float_to_currency(self.amountdue)
        else:
            if self.multi and self.parent.item_width >= 25:
                self.amount_label.text = '%d' % self.multi
            else:
                self.amount_label.text = ''
            self.payee_label.text = ''
    def leb_realized(self, eb):
        self.pixbuf = functions.pixbufFromPath(
            "/usr/share/firstboot/pixmaps/firstboot-left.png")
        scaledPixbuf = self.pixbuf.scale_simple(int(0.2 * self.x_screen),
                                                self.y_screen,
                                                gtk.gdk.INTERP_BILINEAR)

        bgimage = gtk.gdk.Pixmap(eb.window, int(0.2 * self.x_screen),
                                 self.y_screen, -1)
        bgimage.draw_pixbuf(None, scaledPixbuf, 0, 0, 0, 0)

        style = gtk.Style()
        style.bg_pixmap[gtk.STATE_NORMAL] = bgimage
        eb.set_style(style)
Beispiel #12
0
 def _get_item(self, label, icon):
     try:
         pixbuf = gtk.gdk.pixbuf_new_from_file(icon)
         ick = gtk.IconSet(pixbuf)
         scaled = ick.render_icon(gtk.Style(), gtk.TEXT_DIR_LTR,
                                  gtk.STATE_NORMAL, gtk.ICON_SIZE_MENU,
                                  None, None)
         img = gtk.image_new_from_pixbuf(scaled)
         item = gtk.ImageMenuItem(stock_id=label)
         item.set_image(img)
     except:
         # Icon not found
         item = gtk.MenuItem(label=label)
     return item
Beispiel #13
0
    def setup_matplotlib_widget(self):
        style = gtk.Style()
        self.figure = Figure(dpi=72,
                             edgecolor=str(style.bg[2]),
                             facecolor=str(style.bg[2]))

        self.plot = self.figure.add_subplot(111)
        self.figure.subplots_adjust(bottom=0.20)

        self.matlib_canvas = FigureCanvasGTK(self.figure)

        self.plot.autoscale_view()

        self.graph_parent.add(self.matlib_canvas)
        self.graph_parent.show_all()
Beispiel #14
0
 def _set_consistent(self, valuewidget, variable):
     normal_style = gtk.Style()
     normal_base = normal_style.base[gtk.STATE_NORMAL]
     normal_fg = normal_style.fg[gtk.STATE_NORMAL]
     normal_text = normal_style.text[gtk.STATE_NORMAL]
     valuewidget.modify_base(gtk.STATE_NORMAL, normal_base)
     self.is_inconsistent = True
     for widget in valuewidget.get_children():
         widget.modify_text(gtk.STATE_NORMAL, normal_text)
         if hasattr(widget, 'set_inconsistent'):
             widget.set_inconsistent(False)
         if isinstance(widget, gtk.Entry):
             widget.modify_fg(gtk.STATE_NORMAL, normal_fg)
         if (hasattr(widget, 'get_group')
                 and hasattr(widget.get_group(), 'set_inconsistent')):
             widget.get_group().set_inconsistent(False)
Beispiel #15
0
    def __init__(self):
        gtk.CellRendererText.__init__(self)

        self.set_property("mode", gtk.CELL_RENDERER_MODE_ACTIVATABLE)
        self.__relative_header_size = -0.2  # Make header 20% smaller than normal fonts

        # Grab some default theme settings
        # they are probably incorrect, but we reset
        # them on each render anyway.
        style = gtk.Style()
        self.header_font_desc = style.font_desc
        self.header_font_desc.set_weight(pango.WEIGHT_BOLD)
        self.header_font_desc.set_size(self.header_font_desc.get_size() +
                                       int(self.header_font_desc.get_size() *
                                           self.__relative_header_size))
        self.header_bg = style.base[gtk.STATE_NORMAL]
Beispiel #16
0
    def __init__(self, text, interactive = True, color = "#F1EAAA"):
        graphics.Sprite.__init__(self, interactive = interactive)

        self.width, self.height = 0,0

        font = gtk.Style().font_desc
        font_size = int(font.get_size() * 0.8 / pango.SCALE) # 80% of default

        self.label = graphics.Label(text, size = font_size, color = (30, 30, 30), y = 1)
        self.color = color
        self.add_child(self.label)

        self.corner = int((self.label.height + 3) / 3) + 0.5
        self.label.x = self.corner + 6

        self.text = stuff.escape_pango(text)
        self.connect("on-render", self.on_render)
Beispiel #17
0
 def __init__(self, value, metadata, set_value, hook, arg_str=None):
     super(QuotedTextValueWidget, self).__init__(homogeneous=False,
                                                spacing=0)
     # Importing here prevents cyclic imports
     import rose.macros.value
     self.type = metadata.get(rose.META_PROP_TYPE)
     checker = rose.macros.value.ValueChecker()
     if self.type == "character":
         self.type_checker = checker.check_character
         self.format_text_in = (
                     rose.config_editor.util.text_for_character_widget)
         self.format_text_out = (
                     rose.config_editor.util.text_from_character_widget)
         self.quote_char = "'"
         self.esc_quote_chars = "''"
     elif self.type == "quoted":
         self.type_checker = checker.check_quoted
         self.format_text_in = (
                     rose.config_editor.util.text_for_quoted_widget)
         self.format_text_out = (
                     rose.config_editor.util.text_from_quoted_widget)
         self.quote_char = '"'
         self.esc_quote_chars = '\\"'
     self.value = value
     self.metadata = metadata
     self.set_value = set_value
     self.hook = hook
     self.entry = gtk.Entry()
     insensitive_colour = gtk.Style().bg[0]
     self.entry.modify_bg(gtk.STATE_INSENSITIVE,
                          insensitive_colour)
     self.in_error = not self.type_checker(self.value)
     self.set_entry_text()
     self.entry.connect("button-release-event",
                        self._handle_middle_click_paste)
     self.entry.connect_after("paste-clipboard", self.setter)
     self.entry.connect_after("key-release-event",
                              lambda e, v: self.setter(e))
     self.entry.connect_after("button-release-event",
                              lambda e, v: self.setter(e))
     self.entry.show()
     self.pack_start(self.entry, expand=True, fill=True,
                     padding=0)
     self.entry.connect('focus-in-event', self.hook.trigger_scroll)
     self.grab_focus = lambda : self.hook.get_focus(self.entry)
Beispiel #18
0
 def get_icon(iconname):
     if (iconname == "" or iconname.find('.') <> -1):
         try:
             pixbuf = gtk.gdk.pixbuf_new_from_file(
                 xdg.IconTheme.getIconPath(iconname))
             ick = gtk.IconSet(pixbuf)
             scaled = ick.render_icon(gtk.Style(), gtk.TEXT_DIR_LTR,
                                      gtk.STATE_NORMAL,
                                      gtk.ICON_SIZE_LARGE_TOOLBAR, None,
                                      None)
             img = gtk.image_new_from_pixbuf(scaled)
         except (TypeError, glib.GError):
             img = gtk.image_new_from_stock(gtk.STOCK_DIALOG_QUESTION,
                                            gtk.ICON_SIZE_LARGE_TOOLBAR)
     else:
         img = gtk.image_new_from_icon_name(iconname,
                                            gtk.ICON_SIZE_LARGE_TOOLBAR)
     return img
Beispiel #19
0
    def create_pixbuf(self, path):
        pix = self.create_thumbnail_pixbuf(path)
        if pix != None:
            return pix

        style = gtk.Style()

        icon = style.lookup_icon_set(gtk.STOCK_FILE)
        pix = icon.render_icon(style, gtk.TEXT_DIR_NONE, gtk.STATE_NORMAL,
                               gtk.ICON_SIZE_DIALOG, None, None)

        if not os.path.islink(path) and os.path.isdir(path):
            t = "directory"
            icon = style.lookup_icon_set(gtk.STOCK_DIRECTORY)
            pix = icon.render_icon(style, gtk.TEXT_DIR_NONE,
                                   gtk.STATE_NORMAL, gtk.ICON_SIZE_DIALOG,
                                   None, None)
        return pix
Beispiel #20
0
    def setup_matplotlib_widget(self):
        style = gtk.Style()
        self.figure = Figure(dpi=72,
                             edgecolor=str(style.bg[2]),
                             facecolor=str(style.bg[2]))

        self.plot = self.figure.add_subplot(111)
        self.plot.set_ylabel('# of peaks', labelpad=1)
        self.plot.set_xlabel('Threshold', labelpad=1)
        self.plot.autoscale_view()

        self.figure.subplots_adjust(left=0.15,
                                    right=0.875,
                                    top=0.875,
                                    bottom=0.15)
        self.matlib_canvas = FigureCanvasGTK(self.figure)

        self.graph_parent.add(self.matlib_canvas)
        self.graph_parent.show_all()
Beispiel #21
0
    def __init__(self, text, interactive=True, color="#F1EAAA"):
        graphics.Sprite.__init__(self, interactive=interactive)

        self.text = text

        font = gtk.Style().font_desc
        font_size = int(font.get_size() * 0.8 / pango.SCALE)  # 80% of default

        label = graphics.Label(text, size=font_size, color=(30, 30, 30), y=1)

        corner = int((label.height + 3) / 3) + 0.5
        label.x = corner + 6

        w, h = int(label.x + label.width +
                   label.height * 0.3), label.height + 3

        self.color = color

        self.tag = graphics.Polygon([(0.5, corner), (corner, 0.5),
                                     (w + 0.5, 0.5), (w + 0.5, h - 0.5),
                                     (corner, h - 0.5), (0.5, h - corner)],
                                    fill=self.color,
                                    stroke="#b4b4b4",
                                    line_width=1,
                                    cache_as_bitmap=True)

        self.add_child(self.tag)
        self.add_child(
            graphics.Circle(3,
                            3,
                            x=2,
                            y=h / 2 - 2,
                            fill="#fff",
                            stroke="#b4b4b4",
                            line_width=1,
                            cache_as_bitmap=True))

        self.add_child(label)
        self.width, self.height = w, h

        self.graphics.set_color((0, 0, 0), 0)
        self.graphics.rectangle(0, 0, w, h)
        self.graphics.stroke()
Beispiel #22
0
 def load_client_icons(self):
     for fname in os.listdir(PIXMAPS_DIR):
         name = os.path.splitext(fname)[0]
         if not name.startswith('tryton-'):
             continue
         if not os.path.isfile(os.path.join(PIXMAPS_DIR, fname)):
             continue
         try:
             pixbuf = gtk.gdk.pixbuf_new_from_file(
                     os.path.join(PIXMAPS_DIR, fname).decode('utf-8'))
         except (IOError, glib.GError):
             continue
         finally:
             self._locale_icons.add(name)
         icon_set = gtk.IconSet(pixbuf)
         self.add(name, icon_set)
     for name in ('ok', 'cancel'):
         icon_set = gtk.Style().lookup_icon_set('gtk-%s' % name)
         self.add('tryton-%s' % name, icon_set)
         self._locale_icons.add('tryton-%s' % name)
Beispiel #23
0
    </field>
  </form>
</xml>

"""

xml_escapes = [("<", "&lt;"), (">", "&gt;"), ("&", "&amp;"), ('"', "&quot;"),
               ("'", "&apos;")]

RESPONSE_SEND = -900
RESPONSE_SAVE = -901
RESPONSE_REPLY = -902
RESPONSE_DELETE = -903
RESPONSE_SEND_VIA = -904

style = gtk.Style()
for i in [style.fg, style.bg, style.base]:
    i[gtk.STATE_INSENSITIVE] = i[gtk.STATE_NORMAL]
STYLE_BRIGHT_INSENSITIVE = style
del style
del i


def xml_escape(string):
    d = {}
    for char, esc in xml_escapes:
        d[char] = esc

    out = ""
    for i in string:
        out += d.get(i, i)
Beispiel #24
0
 def setup_figure(self):
     style = gtk.Style()
     self.figure = Figure(dpi=72,
                          edgecolor=str(style.bg[2]),
                          facecolor=str(style.bg[0]))
     self.figure.subplots_adjust(hspace=0.0, wspace=0.0)