def backup(view, lscmd, backup_dir):
    make_path(backup_dir)
    out = os.popen("cd /view/" + view +" ; " + lscmd)
    line = out.readline().strip()
    while len(line) > 0:
        outpath = os.path.join(backup_dir, line.strip("\"/"))
        (outdir, outfile) = os.path.split(outpath)
        os.makepath(outdir)
        cmd = "cp " + line + " \"" + outdir + "\""
        print cmd
        os.system(cmd)
        line = out.readline().strip()
    out.close()
Beispiel #2
0
 def __layout_ui(self):
     self.log.debug("{0}: Laying out User Interface".format(self))
     self.__create_menu()
     opane = Gtk.VPaned()
     opane.pack1(self.ilist)
     opane.pack2(self.view)
     pane = Gtk.HPaned()
     pane.pack1(self.tree)
     pane.pack2(opane)
     al = Gtk.Alignment.new(0.5,0.5,1,1)
     al.set_padding(3,3,3,3)
     al.add(pane)
     box = Gtk.VBox(spacing=3)
     box.pack_start(self.ui.get_widget('/Menubar'), False, True, 0)
     box.pack_start(self.ui.get_widget('/Toolbar'), False, True, 0)
     #setting GTK3 style
     ctx= self.ui.get_widget('/Toolbar').get_style_context()
     print "UI Context: ",ctx
     ctx.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
     widget = self.ag.get_action('StopUpdate')
     widget.set_sensitive(False)
     box.pack_start(al, True, True, 0)
     box.pack_start(self.status, False, False, 0)
     self.add(box)
     self.set_property("height-request", 700)
     self.set_property("width-request", 1024)
     self.is_fullscreen = False
     self.__reset_title()
     self.set_icon_from_file(make_path('icons/hicolor','brss.svg'))
     self.alert = Alerts(self)
     self.connect("destroy", self.quit)
     self.show_all()
     if not self.settings.get_boolean('show-status'):
         self.status.hide()
 def make_results_dir(self):
     results_dir = make_path("results", self.make_results_name())
     if not os.path.exists(results_dir):
         os.makedirs(results_dir)
     return results_dir
Beispiel #4
0
 def run_engine(self):
     d = make_path('applications', 'brss-engine.desktop')
     info = Gio.DesktopAppInfo.new_from_filename(d)
     info.launch((), None)
Beispiel #5
0
    def __init__(self,logger):
        self.log = logger
        GObject.GObject.__init__(self)
        GObject.type_register(Tree)
        #store (type,id,name,count,stock-id, url, category_id)
        self.lmap = ['type','id','name','count','stock-id','url','category']
        self.store = Gtk.TreeStore(str, str, str, int, str, str, str)
        self.store.set_sort_func(2, self.__sort_type, 0)
        #~ self.store.set_default_sort_func(self.__sort_type, 0)
        self.store.set_sort_column_id(2, Gtk.SortType.ASCENDING)
        self.menuview = Gtk.TreeView()
        self.menuview.set_model(self.store)
        self.menuview.set_headers_visible(False)
        col = Gtk.TreeViewColumn()
        textcell = Gtk.CellRendererText()
        iconcell = Gtk.CellRendererPixbuf()
        col.pack_start(iconcell, False)
        col.pack_start(textcell, True)
        col.set_cell_data_func(textcell, self.__format_name)
        #~ self.menucol.set_cell_data_func(self.iconcell, self.__format_icon)
        col.add_attribute(iconcell, "stock-id", 4)
        col.set_sort_order(Gtk.SortType.ASCENDING)
        self.menuview.append_column(col)
        self.menuselect = self.menuview.get_selection()
        ## SPECIALS
        self.sstore = Gtk.TreeStore(str, str, str, int, str)
        self.sview = Gtk.TreeView()
        self.sview.set_model(self.sstore)
        self.sview.set_headers_visible(False)
        col = Gtk.TreeViewColumn()
        textcell = Gtk.CellRendererText()
        iconcell = Gtk.CellRendererPixbuf()
        col.pack_start(iconcell, False)
        col.pack_start(textcell, True)
        col.set_cell_data_func(textcell, self.__format_name)
        col.add_attribute(iconcell, "stock-id", 4)
        self.sview.append_column(col)
        self.sselect = self.sview.get_selection()

        # containers
        msc = Gtk.ScrolledWindow()
        msc.set_shadow_type(Gtk.ShadowType.IN)
        msc.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER)
        msc.add(self.sview)
        self.pack_start(msc, False, True, 0)
        msc = Gtk.ScrolledWindow()
        msc.set_shadow_type(Gtk.ShadowType.IN)
        msc.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        msc.add(self.menuview)
        mal = Gtk.Alignment.new(0.5, 0.5, 1, 1)
        self.pack_start(msc, True, True,0)
        self.set_property("width-request", 300)
        menu = TreeMenu(self)
        self.current_item = None
        self.__setup_dnd()
        self.__favlist = []
        self.__setup_icons(make_path('pixmaps','brss-feed.svg'), 'feed')
        self.__setup_icons(make_path('pixmaps','logo2.svg'), 'logo')
        self.__setup_icons(make_path('pixmaps','brss-feed-missing.svg'), 'missing')
        self.__setup_icons(make_path('pixmaps','starred.svg'), 'starred')
        self.__connect_signals()