Ejemplo n.º 1
0
    def open_project(self, window, filename):
        if not self.close_project(False):
            return

        f = open(filename)
        file = File(f.read())
        f.close()

        if file.version != mprj.project_version:
            moo.error_dialog(window, _("Could not open project '%s'") % (filename,),
                             _("Invalid project version %s") % (file.version,))
	    return

        file.path = filename
        project_type = self.project_types.get(file.project_type)
        config_type = getattr(project_type, '__config__')
        config = config_type(file)

        self.project = project_type(window, config, file)
        self.project.load()
        self.__set_title_prefix(self.project.name)
        self.recent_list.add_filename(filename)
        moo.prefs_set_string("Plugins/Project/last", filename)

        close = self.window.get_action("CloseProject")
        options = self.window.get_action("ProjectOptions")
        if close:
            close.set_property("sensitive", True)
        if options:
            options.set_property("visible", True)
Ejemplo n.º 2
0
 def font_item_activated(self, *whatever):
     dlg = gtk.FontSelectionDialog(D_("Pick a Font", "gtk20"))
     # dlg.fontsel.set_property('monospace', True)
     old_font = self.get_font()
     if old_font:
         dlg.set_font_name(old_font.to_string())
     if dlg.run() == gtk.RESPONSE_OK:
         font_name = dlg.get_font_name()
         if font_name:
             new_font = pango.FontDescription(font_name)
             if old_font != new_font:
                 self.set_font_from_string(font_name)
                 moo.prefs_set_string(FONT_KEY, font_name)
     dlg.destroy()
Ejemplo n.º 3
0
 def close_project_cb(self, window):
     if self.project:
         if self.close_project(False):
             moo.prefs_set_string("Plugins/Project/last", None)
     else:
         self.fixme(window, "disable Close Project command")
Ejemplo n.º 4
0
def get_format_from_list(treeview):
    model, row = treeview.get_selection().get_selected()
    fmt = model[row][1]
    moo.prefs_set_string('Tools/InsertDateAndTime', fmt)
    return fmt
Ejemplo n.º 5
0
 def color_scheme_item_activated(self, item, color_scheme):
     self.set_color_scheme(color_scheme)
     if color_scheme.colors:
         moo.prefs_set_string(COLOR_SCHEME_KEY, color_scheme.name)
     else:
         moo.prefs_set_string(COLOR_SCHEME_KEY, None)