예제 #1
0
파일: cache.py 프로젝트: rammstein/0install
 def append_to(self, model, iter):
     model.append(
         iter,
         extract_columns(
             name=self.impl.local_path,
             tooltip=_('This is a local version, not held in the cache.'),
             object=self))
예제 #2
0
파일: cache.py 프로젝트: rammstein/0install
 def append_to(self, model, iter):
     model.append(
         iter,
         extract_columns(name=self.digest,
                         size=self.size,
                         tooltip=self.impl_path,
                         object=self))
예제 #3
0
파일: cache.py 프로젝트: rammstein/0install
 def append_to(self, model, iter):
     model.append(
         iter,
         extract_columns(
             name=self.impl.local_path, tooltip=_("This is a local version, not held in the cache."), object=self
         ),
     )
예제 #4
0
	def append_to(self, model, iter):
		model.append(iter, extract_columns(
			name=self.uri.rsplit('/', 1)[-1],
			uri=self.uri,
			size=self.size,
			tooltip=escape(self.ex),
			object=self))
예제 #5
0
파일: cache.py 프로젝트: timdiels/0install
	def append_to(self, model, iter):
		model.append(iter, extract_columns(
			name=self.uri.rsplit('/', 1)[-1],
			uri=self.uri,
			size=self.size,
			tooltip=self.ex,
			object=self))
예제 #6
0
 def append_to(self, model, iter):
     model.append(iter, [
         _('Version %(implementation_version)s : %(implementation_id)s') % {
             'implementation_version': self.impl.get_version(),
             'implementation_id': self.impl.id
         }, self.size, None, None, self
     ])
예제 #7
0
파일: cache.py 프로젝트: rammstein/0install
    def append_to(self, model, iter):
        impl = self.impl
        label = _("Version %(implementation_version)s (%(arch)s)") % {
            "implementation_version": impl.get_version(),
            "arch": impl.arch or "any platform",
        }

        model.append(iter, extract_columns(name=label, size=self.size, tooltip=self.impl_path, object=self))
예제 #8
0
	def update_fields(self):
		root = self.doc.documentElement

		def set(name):
			value = singleton_text(root, name)
			if value:
				self.wTree.get_widget('feed_' + name).set_text(value)
		set('name')
		set('summary')
		set('homepage')

		needs_terminal = len(list(children(root, 'needs-terminal'))) > 0
		self.wTree.get_widget('feed_needs_terminal').set_active(needs_terminal)

		category_widget = self.wTree.get_widget('feed_category')
		category = singleton_text(root, 'category')
		if category:
			combo_set_text(category_widget, category)
		else:
			category_widget.set_active(0)

		uri = root.getAttribute('uri')
		if uri:
			self.wTree.get_widget('feed_url').set_text(uri)

		for feed_for in children(root, 'feed-for'):
			self.wTree.get_widget('feed_feed_for').set_text(feed_for.getAttribute('interface'))

		for icon in children(root, 'icon'):
			if icon.getAttribute('type') == 'image/png':
				href = icon.getAttribute('href')
				self.wTree.get_widget('feed_icon').set_text(href)
				break

		description = singleton_text(root, 'description') or ''
		paragraphs = [format_para(p) for p in description.split('\n\n')]
		buffer = self.wTree.get_widget('feed_description').get_buffer()
		buffer.delete(buffer.get_start_iter(), buffer.get_end_iter())
		buffer.insert_at_cursor('\n'.join(paragraphs))

		key_menu = self.wTree.get_widget('feed_key')
		model = key_menu.get_model()
		if self.key:
			i = 0
			for line in model:
				if line[0] == self.key:
					break
				i += 1
			else:
				model.append((self.key, 'Missing key (%s)' % self.key))
			key_menu.set_active(i)
		else:
			key_menu.set_active(0)

		self.update_version_model()
예제 #9
0
파일: cache.py 프로젝트: timdiels/0install
	def append_to(self, model, iter):
		impl = self.impl
		label = _('Version %(implementation_version)s (%(arch)s)') % {
				'implementation_version': impl.get_version(),
				'arch': impl.arch or 'any platform'}

		model.append(iter, extract_columns(
			name=label,
			size=self.size,
			tooltip=self.impl_path,
			object=self))
예제 #10
0
	def append_to(self, model, iter):
		impl = self.impl
		label = _('Version %(implementation_version)s (%(arch)s)') % {
				'implementation_version': impl['version'],
				'arch': impl['arch'] or 'any platform'}

		model.append(iter, extract_columns(
			name=label,
			size=self.size,
			tooltip=self.impl_path,
			object=self))
예제 #11
0
 def append_to(self, model, iter):
     model.append(
         iter,
         [
             _("Version %(implementation_version)s : %(implementation_id)s")
             % {"implementation_version": self.impl.get_version(), "implementation_id": self.impl.id},
             self.size,
             None,
             None,
             self,
         ],
     )
예제 #12
0
	def populate_model(self):
		model = self.model
		model.clear()

		default_icon = self.window.render_icon(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_DIALOG)

		for uri in self.app_list.get_apps():
			itr = model.append()
			model[itr][AppListBox.URI] = uri

			iface = self.iface_cache.get_interface(uri)
			name = iface.get_name()
			summary = iface.summary or _('No information available')
			summary = summary[:1].capitalize() + summary[1:]

			model[itr][AppListBox.NAME] = name
			pixbuf = icon.load_icon(self.iface_cache.get_icon_path(iface))
			if not pixbuf:
				pixbuf = default_icon
			else:
				# Cap icon size, some icons are really high resolution
				pixbuf = self.cap_pixbuf_dimensions(pixbuf, default_icon.get_width())
			model[itr][AppListBox.ICON] = pixbuf

			model[itr][AppListBox.MARKUP] = '<b>%s</b>\n<i>%s</i>' % (_pango_escape(name), _pango_escape(summary))
예제 #13
0
	def append_to(self, model, iter):
		iter2 = model.append(iter, extract_columns(
			name=self.feed['name'],
			uri=self.uri,
			tooltip=escape(self.feed['summary']),
			object=self))
		for cached_impl in self.feed['in-cache']:
			KnownImplementation(self, cached_impl).append_to(model, iter2)
예제 #14
0
파일: cache.py 프로젝트: rammstein/0install
 def append_to(self, model):
     return model.append(
         None,
         extract_columns(
             name=self.name,
             tooltip=self.tooltip,
             object=self,
         ))
예제 #15
0
파일: cache.py 프로젝트: timdiels/0install
	def append_to(self, model, iter):
		iter2 = model.append(iter, extract_columns(
			name=self.feed.get_name(),
			uri=self.uri,
			tooltip=self.feed.summary,
			object=self))
		for cached_impl in self.in_cache:
			cached_impl.append_to(model, iter2)
예제 #16
0
 def append_to(self, model, iter):
     model.append(iter, [
         self.impl.id, 0, None,
         _('This is a local version, not held in the cache.'), self
     ])
예제 #17
0
 def append_to(self, model, iter):
     model.append(iter, [self.uri, self.size, None, self.ex, self])
예제 #18
0
 def append_to(self, model, iter):
     iter2 = model.append(
         iter, [self.uri, self.size, None,
                summary(self.iface), self])
     for cached_impl in self.in_cache:
         cached_impl.append_to(model, iter2)
예제 #19
0
		def local_archive_changed(chooser):
			model.clear()
			path = chooser.get_filename()
			widgets.get_widget('subdirectory_frame').set_sensitive(False)
			self.destroy_tmp()
			if not path: return

			if mime_type.get_active() == 0:
				type = None
			else:
				type = mime_type.get_active_text()

			archive_url = widgets.get_widget('archive_url')
			url = archive_url.get_text()
			if not url:
				url = 'http://SITE/' + os.path.basename(path)
				archive_url.set_text(url)

			start_offset = 0
			if not type:
				if url.endswith('.package'):
					type = 'Autopackage'
				else:
					type = unpack.type_from_url(url)

			if type == 'Autopackage':
				# Autopackage isn't a real type. Examine the .package file
				# and find out what it really is.
				start_offset, type = autopackage_get_details(path)

			self.tmpdir = tempfile.mkdtemp('-0publish-gui')
			try:
				# Must be readable to helper process running as 'zeroinst'...
				old_umask = os.umask(0022)
				try:
					unpack_dir = os.path.join(self.tmpdir, 'unpacked')
					os.mkdir(unpack_dir)

					dialog.window.set_cursor(watch)
					gtk.gdk.flush()
					try:
						unpack.unpack_archive(url, file(path), unpack_dir,
								      type = type, start_offset = start_offset)
						manifest.fixup_permissions(unpack_dir)
					finally:
						dialog.window.set_cursor(None)
				finally:
					os.umask(old_umask)
			except:
				chooser.unselect_filename(path)
				self.destroy_tmp()
				raise
			iter = model.append(None, ['Everything'])
			items = os.listdir(unpack_dir)
			for f in items:
				model.append(iter, [f])
			tree.expand_all()
			# Choose a sensible default
			iter = model.get_iter_root()
			if len(items) == 1 and \
		           os.path.isdir(os.path.join(unpack_dir, items[0])) and \
			   items[0] not in ('usr', 'opt', 'bin', 'etc', 'sbin', 'doc', 'var'):
				iter = model.iter_children(iter)
			selection.select_iter(iter)

			self.mime_type = type
			self.start_offset = start_offset
			widgets.get_widget('subdirectory_frame').set_sensitive(True)
예제 #20
0
	def append_to(self, model):
		return model.append(None, extract_columns(
			name=self.name,
			tooltip=self.tooltip,
			object=self,
		))
예제 #21
0
 def append_to(self, model, iter):
     model.append(iter, [self.impl.id, 0, None, _("This is a local version, not held in the cache."), self])
예제 #22
0
 def append_to(self, model, iter):
     model.append(iter, [self.uri, self.size, None, self.ex, self])
예제 #23
0
 def append_to(self, model, iter):
     iter2 = model.append(iter, [self.uri, self.size, None, summary(self.iface), self])
     for cached_impl in self.in_cache:
         cached_impl.append_to(model, iter2)
예제 #24
0
 def append_to(self, model, iter):
     model.append(iter, [self.name, self.size, None, self.impl_path, self])
예제 #25
0
 def append_to(self, model, iter):
     model.append(iter, [self.name, self.size, None, self.impl_path, self])
예제 #26
0
	def append_to(self, model, iter):
		model.append(iter, extract_columns(
			name=self.digest,
			size=self.size,
			tooltip=self.impl_path,
			object=self))