Ejemplo n.º 1
0
	def update_view(self, *args):
		path = self.current_dir
		if self.root:
			path = path.replace(self.root, '::')
		self.column.set_title(path)

		new_model = FileListModel(self.current_dir,
							[],
							True,
							self.root)
		self.treeview.set_model(new_model)

		if self.undo:
			self.back_but.set_sensitive(True)
		else:
			self.back_but.set_sensitive(False)

		if self.redo:
			self.forward_but.set_sensitive(True)
		else:
			self.forward_but.set_sensitive(False)

		self.home_but.set_sensitive(True)
		if self.current_dir == os.path.expanduser('~'):
			self.home_but.set_sensitive(False)
		if self.root and self.current_dir == self.root:
			self.home_but.set_sensitive(False)

		self.up_but.set_sensitive(True)
		if self.root:
			if self.current_dir == self.root:
				self.up_but.set_sensitive(False)
		else:
			if self.current_dir == os.path.abspath(os.path.join(self.current_dir, '..')):
				self.up_but.set_sensitive(False)
Ejemplo n.º 2
0
    def update_view(self, *args):
        path = '' + config.scr_current_directory
        if self.root:
            path = path.replace(self.root, '::')
        self.column.set_title(path)

        filters = [
            'py',
        ]
        config.scr_show_all_files = self.find_but.get_active()
        if self.find_but.get_active():
            filters = []

        new_model = FileListModel(config.scr_current_directory, filters,
                                  config.scr_show_hidden_files, self.root)
        self.treeview.set_model(new_model)

        if self.undo:
            self.back_but.set_sensitive(True)
        else:
            self.back_but.set_sensitive(False)

        if self.redo:
            self.forward_but.set_sensitive(True)
        else:
            self.forward_but.set_sensitive(False)

        self.home_but.set_sensitive(True)
        if self.current_dir == os.path.expanduser('~'):
            self.home_but.set_sensitive(False)
        if self.root and self.current_dir == self.root:
            self.home_but.set_sensitive(False)

        self.up_but.set_sensitive(True)
        if self.root:
            if self.current_dir == self.root:
                self.up_but.set_sensitive(False)
        else:
            if self.current_dir == os.path.abspath(
                    os.path.join(self.current_dir, '..')):
                self.up_but.set_sensitive(False)
Ejemplo n.º 3
0
    def __init__(self, app, root=''):
        gtk.VBox.__init__(self, False, 0)
        self.mw = app.mw
        self.app = app
        self.caption_label = TabIconCaption(gtk.STOCK_MEDIA_PLAY, self.caption)
        self.root = root

        self.current_dir = "" + config.scr_current_directory

        spacer = gtk.VBox()
        self.add(spacer)
        self.set_border_width(5)

        label = gtk.Label(self.caption.upper())
        spacer.pack_start(label, False)

        separator = gtk.HSeparator()
        spacer.pack_start(separator, False)

        nav_panel = gtk.HBox()
        nav_panel.set_border_width(3)

        self.back_but = NavigationButton(gtk.STOCK_GO_BACK, _('Go Back'))
        nav_panel.pack_start(self.back_but, False)
        self.back_but.connect('clicked', self.action_back)

        self.up_but = NavigationButton(gtk.STOCK_GO_UP, _('Go Up'))
        nav_panel.pack_start(self.up_but, False)
        self.up_but.connect('clicked', self.action_up)

        self.forward_but = NavigationButton(gtk.STOCK_GO_FORWARD,
                                            _('Go Forward'))
        nav_panel.pack_start(self.forward_but, False)
        self.forward_but.connect('clicked', self.action_forward)

        self.home_but = NavigationButton(gtk.STOCK_HOME, _('Home directory'))
        nav_panel.pack_start(self.home_but, False)
        self.home_but.connect('clicked', self.action_home)

        separator = gtk.VSeparator()
        nav_panel.pack_start(separator, False, padding=2)

        self.refr_but = NavigationButton(gtk.STOCK_REFRESH, _('Refresh'))
        nav_panel.pack_start(self.refr_but, False)
        self.refr_but.connect('clicked', self.update_view)

        separator = gtk.VSeparator()
        nav_panel.pack_start(separator, False, padding=2)

        self.find_but = NavigationToggleButton(gtk.STOCK_FIND,
                                               _('Show all files'))
        nav_panel.pack_start(self.find_but, False)
        self.find_but.connect('clicked', self.update_view)

        spacer.pack_start(nav_panel, False)

        self.listmodel = FileListModel()

        self.treeview = gtk.TreeView()

        self.column = gtk.TreeViewColumn()
        self.column.set_title(_('Log Entries'))
        render_pixbuf = gtk.CellRendererPixbuf()
        self.column.pack_start(render_pixbuf, expand=False)
        self.column.add_attribute(render_pixbuf, 'pixbuf', 0)
        render_text = gtk.CellRendererText()
        self.column.pack_start(render_text, expand=True)
        self.column.add_attribute(render_text, 'text', 1)
        self.treeview.append_column(self.column)

        self.treeview.connect('row-activated', self.open_file)

        self.scrolledwindow = gtk.ScrolledWindow()
        self.scrolledwindow.add(self.treeview)
        self.scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        self.scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        spacer.pack_end(self.scrolledwindow, True)

        self.treeview.set_model(self.listmodel)
        self.treeview.set_rules_hint(True)
        events.connect(events.CONFIG_MODIFIED, self.update_by_config)
        self.find_but.set_active(config.scr_show_all_files)
        self.update_view()
Ejemplo n.º 4
0
	def __init__(self, app, presenter):
		gtk.VBox.__init__(self, False, 0)
		self.mw = app.mw
		self.app = app
		self.presenter = presenter

		self.root = self.presenter.doc_presenter.doc_dir

		self.current_dir = "" + self.root

		spacer = gtk.VBox()
		self.add(spacer)
		self.set_border_width(5)

		nav_panel = gtk.HBox()
		nav_panel.set_border_width(0)

		self.back_but = NavigationButton(gtk.STOCK_GO_BACK, _('Go Back'))
		nav_panel.pack_start(self.back_but, False)
		self.back_but.connect('clicked', self.action_back)

		self.up_but = NavigationButton(gtk.STOCK_GO_UP, _('Go Up'))
		nav_panel.pack_start(self.up_but, False)
		self.up_but.connect('clicked', self.action_up)

		self.forward_but = NavigationButton(gtk.STOCK_GO_FORWARD, _('Go Forward'))
		nav_panel.pack_start(self.forward_but, False)
		self.forward_but.connect('clicked', self.action_forward)

		self.home_but = NavigationButton(gtk.STOCK_HOME, _('Home directory'))
		nav_panel.pack_start(self.home_but, False)
		self.home_but.connect('clicked', self.action_home)

		separator = gtk.VSeparator()
		nav_panel.pack_start(separator, False, padding=2)

		self.refr_but = NavigationButton(gtk.STOCK_REFRESH, _('Refresh'))
		nav_panel.pack_start(self.refr_but, False)
		self.refr_but.connect('clicked', self.update_view)


		spacer.pack_start(nav_panel, False)

		self.listmodel = FileListModel()

		self.treeview = gtk.TreeView()

		self.column = gtk.TreeViewColumn()
		self.column.set_title(_('Log Entries'))
		render_pixbuf = gtk.CellRendererPixbuf()
		self.column.pack_start(render_pixbuf, expand=False)
		self.column.add_attribute(render_pixbuf, 'pixbuf', 0)
		render_text = gtk.CellRendererText()
		self.column.pack_start(render_text, expand=True)
		self.column.add_attribute(render_text, 'text', 1)
		self.treeview.append_column(self.column)

		self.treeview.connect('row-activated', self.open_file)

		self.scrolledwindow = gtk.ScrolledWindow()
		self.scrolledwindow.add(self.treeview)
		self.scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)
		self.scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
		spacer.pack_end(self.scrolledwindow, True)

		self.treeview.set_model(self.listmodel)
		self.treeview.set_rules_hint(True)
		self.update_view()