def __init__(self, parent, window):
		MountManagerExtension.__init__(self, parent, window)
		self._store = gtk.ListStore(str, str, str, str, bool, object)
		self._volumes = {}

		# create interface
		container = gtk.ScrolledWindow() 
		container.set_shadow_type(gtk.SHADOW_IN)
		container.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)

		self._list = gtk.TreeView(model=self._store)
		self._list.set_show_expanders(True)
		self._list.set_search_column(MountsColumn.NAME)

		cell_icon = gtk.CellRendererPixbuf()
		cell_name = gtk.CellRendererText()
		cell_mounted = gtk.CellRendererToggle()
		cell_mounted.connect('toggled', self._mount_toggled)

		col_name = gtk.TreeViewColumn(_('Name'))
		col_name.pack_start(cell_icon, False)
		col_name.pack_start(cell_name, True)
		col_name.set_expand(True)

		col_name.add_attribute(cell_icon, 'icon-name', VolumesColumn.ICON)
		col_name.add_attribute(cell_name, 'text', VolumesColumn.NAME)

		col_mounted = gtk.TreeViewColumn(_('Mounted'), cell_mounted, active=VolumesColumn.MOUNTED)

		self._list.append_column(col_name)
		self._list.append_column(col_mounted)

		# create buttons
		button_mount = gtk.Button()
		button_mount.set_label(_('Mount'))
		button_mount.connect('clicked', self._mount_volume)

		button_unmount = gtk.Button()
		button_unmount.set_label(_('Unmount'))
		button_unmount.connect('clicked', self._unmount_volume)

		# use spinner if possible to denote busy operation
		if hasattr(gtk, 'Spinner'):
			self._spinner = gtk.Spinner()
			self._spinner.set_size_request(20, 20)
			self._spinner.set_property('no-show-all', True)

		else:
			self._spinner = None

		# pack interface
		container.add(self._list)

		if self._spinner is not None:
			self._controls.pack_start(self._spinner, False, False, 0)
		self._controls.pack_end(button_unmount, False, False, 0)
		self._controls.pack_end(button_mount, False, False, 0)

		self._container.pack_start(container, True, True, 0)
示例#2
0
	def __init__(self, parent, window):
		MountManagerExtension.__init__(self, parent, window)
	def __init__(self, parent, window):
		MountManagerExtension.__init__(self, parent, window)

		# create store for mounts
		self._store = gtk.ListStore(str, str, str, str, object, bool)
		self._mounts = {}

		# create interface
		container = gtk.ScrolledWindow() 
		container.set_shadow_type(gtk.SHADOW_IN)
		container.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)

		self._list = gtk.TreeView(model=self._store)
		self._list.set_show_expanders(True)
		self._list.set_search_column(MountsColumn.NAME)

		cell_icon = gtk.CellRendererPixbuf()
		cell_name = gtk.CellRendererText()
		cell_system = gtk.CellRendererToggle()

		# try to set icon size
		try:
			cell_icon.props.stock_size = gtk.ICON_SIZE_LARGE_TOOLBAR
		except:
			pass

		col_name = gtk.TreeViewColumn(_('Name'))
		col_name.pack_start(cell_icon, False)
		col_name.pack_start(cell_name, True)
		col_name.set_expand(True)

		col_name.add_attribute(cell_icon, 'icon-name', MountsColumn.ICON)
		col_name.add_attribute(cell_name, 'markup', MountsColumn.MARKUP_NAME)

		col_system = gtk.TreeViewColumn(_('Systemwide'), cell_system, active=MountsColumn.SYSTEM_WIDE)

		self._list.append_column(col_name)
		self._list.append_column(col_system)

		# create controls
		image_jump = gtk.Image()
		image_jump.set_from_icon_name(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON)
		button_jump = gtk.Button()
		button_jump.set_image(image_jump)
		button_jump.set_label(_('Open'))
		button_jump.connect('clicked', self._open_selected, False)
		try:
			button_jump.set_can_default(True)
		except AttributeError:
			button_jump.set_property('can-default', True)

		image_new_tab = gtk.Image()
		image_new_tab.set_from_icon_name('tab-new', gtk.ICON_SIZE_BUTTON)
		button_new_tab = gtk.Button()
		button_new_tab.set_image(image_new_tab)
		button_new_tab.set_label(_('Open in tab'))
		button_new_tab.set_tooltip_text(_('Open selected URI in new tab'))
		button_new_tab.connect('clicked', self._open_selected, True)

		button_unmount = gtk.Button()
		button_unmount.set_label(_('Unmount'))
		button_unmount.connect('clicked', self._unmount_selected)

		# use spinner if possible to denote busy operation
		if hasattr(gtk, 'Spinner'):
			self._spinner = gtk.Spinner()
			self._spinner.set_size_request(20, 20)
			self._spinner.set_property('no-show-all', True)

		else:
			self._spinner = None

		# pack interface
		container.add(self._list)

		self._controls.pack_start(button_jump, False, False, 0)
		self._controls.pack_start(button_new_tab, False, False, 0)
		self._controls.pack_end(button_unmount, False, False, 0)
		
		self._container.pack_start(container, True, True, 0)
示例#4
0
 def __init__(self, parent, window):
     MountManagerExtension.__init__(self, parent, window)
示例#5
0
    def __init__(self, parent, window):
        MountManagerExtension.__init__(self, parent, window)
        self._store = gtk.ListStore(str, str, str, str, bool, object)
        self._volumes = {}

        # create interface
        container = gtk.ScrolledWindow()
        container.set_shadow_type(gtk.SHADOW_IN)
        container.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)

        self._list = gtk.TreeView(model=self._store)
        self._list.set_show_expanders(True)
        self._list.set_search_column(MountsColumn.NAME)

        cell_icon = gtk.CellRendererPixbuf()
        cell_name = gtk.CellRendererText()
        cell_mounted = gtk.CellRendererToggle()
        cell_mounted.connect('toggled', self._mount_toggled)

        col_name = gtk.TreeViewColumn(_('Name'))
        col_name.pack_start(cell_icon, False)
        col_name.pack_start(cell_name, True)
        col_name.set_expand(True)

        col_name.add_attribute(cell_icon, 'icon-name', VolumesColumn.ICON)
        col_name.add_attribute(cell_name, 'text', VolumesColumn.NAME)

        col_mounted = gtk.TreeViewColumn(_('Mounted'),
                                         cell_mounted,
                                         active=VolumesColumn.MOUNTED)

        self._list.append_column(col_name)
        self._list.append_column(col_mounted)

        # create buttons
        button_mount = gtk.Button()
        button_mount.set_label(_('Mount'))
        button_mount.connect('clicked', self._mount_volume)

        button_unmount = gtk.Button()
        button_unmount.set_label(_('Unmount'))
        button_unmount.connect('clicked', self._unmount_volume)

        # use spinner if possible to denote busy operation
        if hasattr(gtk, 'Spinner'):
            self._spinner = gtk.Spinner()
            self._spinner.set_size_request(20, 20)
            self._spinner.set_property('no-show-all', True)

        else:
            self._spinner = None

        # pack interface
        container.add(self._list)

        if self._spinner is not None:
            self._controls.pack_start(self._spinner, False, False, 0)
        self._controls.pack_end(button_unmount, False, False, 0)
        self._controls.pack_end(button_mount, False, False, 0)

        self._container.pack_start(container, True, True, 0)
示例#6
0
    def __init__(self, parent, window):
        MountManagerExtension.__init__(self, parent, window)

        # create store for mounts
        self._store = gtk.ListStore(str, str, str, str, object, bool)
        self._mounts = {}

        # create interface
        container = gtk.ScrolledWindow()
        container.set_shadow_type(gtk.SHADOW_IN)
        container.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)

        self._list = gtk.TreeView(model=self._store)
        self._list.set_show_expanders(True)
        self._list.set_search_column(MountsColumn.NAME)

        cell_icon = gtk.CellRendererPixbuf()
        cell_name = gtk.CellRendererText()
        cell_system = gtk.CellRendererToggle()

        # try to set icon size
        try:
            cell_icon.props.stock_size = gtk.ICON_SIZE_LARGE_TOOLBAR
        except:
            pass

        col_name = gtk.TreeViewColumn(_('Name'))
        col_name.pack_start(cell_icon, False)
        col_name.pack_start(cell_name, True)
        col_name.set_expand(True)

        col_name.add_attribute(cell_icon, 'icon-name', MountsColumn.ICON)
        col_name.add_attribute(cell_name, 'markup', MountsColumn.MARKUP_NAME)

        col_system = gtk.TreeViewColumn(_('Systemwide'),
                                        cell_system,
                                        active=MountsColumn.SYSTEM_WIDE)

        self._list.append_column(col_name)
        self._list.append_column(col_system)

        # create controls
        image_jump = gtk.Image()
        image_jump.set_from_icon_name(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON)
        button_jump = gtk.Button()
        button_jump.set_image(image_jump)
        button_jump.set_label(_('Open'))
        button_jump.connect('clicked', self._open_selected, False)
        try:
            button_jump.set_can_default(True)
        except AttributeError:
            button_jump.set_property('can-default', True)

        image_new_tab = gtk.Image()
        image_new_tab.set_from_icon_name('tab-new', gtk.ICON_SIZE_BUTTON)
        button_new_tab = gtk.Button()
        button_new_tab.set_image(image_new_tab)
        button_new_tab.set_label(_('Open in tab'))
        button_new_tab.set_tooltip_text(_('Open selected URI in new tab'))
        button_new_tab.connect('clicked', self._open_selected, True)

        button_unmount = gtk.Button()
        button_unmount.set_label(_('Unmount'))
        button_unmount.connect('clicked', self._unmount_selected)

        # use spinner if possible to denote busy operation
        if hasattr(gtk, 'Spinner'):
            self._spinner = gtk.Spinner()
            self._spinner.set_size_request(20, 20)
            self._spinner.set_property('no-show-all', True)

        else:
            self._spinner = None

        # pack interface
        container.add(self._list)

        self._controls.pack_start(button_jump, False, False, 0)
        self._controls.pack_start(button_new_tab, False, False, 0)
        self._controls.pack_end(button_unmount, False, False, 0)

        self._container.pack_start(container, True, True, 0)