Ejemplo n.º 1
0
 def on_btnAdd_clicked(self, widget):
     #self.btnAdd.set_state(gtk.STATE_SELECTED)
     widget.freeze_child_notify()
     c = contextMenu.ContextMenu(self)
     c.addMenuItem(constants.MESSAGE_0056, self.on_add_package, get_icon('deb',16))
     c.addMenuItem(constants.MESSAGE_0057, self.on_add_folder, get_icon('gnome-fs-directory',16))
     gui.popup_emoticons_under_button(c, widget, gui.get_top_window(widget))
     widget.thaw_child_notify()
Ejemplo n.º 2
0
	def on_option_toggle(self, widget):
		if widget == self.optcd:
			self.media_size = constants.CD
			self.media_type = 'CD'
			self.imgmedia.set_from_pixbuf(get_icon('gnome-dev-disc-cdr',48))
		else:
			self.media_size = constants.DVD
			self.media_type = 'DVD'
			self.imgmedia.set_from_pixbuf(get_icon('gnome-dev-disc-dvdrom',48))
Ejemplo n.º 3
0
	def __init__(self, controller = None):
		"""
			Constructor
		"""
		self.controller = controller
		self.glade = gui.get_glade(constants.CREATE_GUI, WINDOW_NAME)

		#Main widget
		self.window = gui.get_widget(self.glade, WINDOW_NAME)
		self.window.set_icon_name(constants.APP_ICON_NAME)

		#get glade widgets
		self.cmbLocation = gui.get_widget(self.glade,'folderlocation')
		self.txtIsoName = gui.get_widget(self.glade,'isoname')
		self.chkCreteMeta = gui.get_widget(self.glade, 'chkcreatemetapackage')
		self.cmdApply = gui.get_widget(self.glade,'cmdApply')
		self.cmdCancel = gui.get_widget(self.glade, 'cmdCancel')
		self.mediaSize = gui.get_widget(self.glade, 'mediasize')
		self.imgmedia = gui.get_widget(self.glade, 'imgmedia')
		
		self.optcd = gui.get_widget(self.glade, 'optcd')
		self.optdvd = gui.get_widget(self.glade, 'optdvd')
		
		cds, dvds = self.controller.get_packages_size()
		cdLabel = gui.get_children(self.optcd, gtk.Label)
		dvdLabel = gui.get_children(self.optdvd, gtk.Label)

		if cdLabel:
		    if cds == 1:
		        cdLabel.set_text(str(cds) + ' CD')
		    else:
		        cdLabel.set_text(str(cds) + ' CDs')
   
		if dvdLabel:
		    if dvds == 1:
		        dvdLabel.set_text(str(dvds) + ' DVD')
		    else:
		        dvdLabel.set_text(str(dvds) + ' DVDs')
			
		self.media_size = constants.CD
		self.media_type = 'CD'
		
		self.imgmedia.set_from_pixbuf(get_icon('gnome-dev-disc-cdr',48))
		
		if self.controller:
			self.window.set_transient_for(self.controller.get_main_window())
			self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

		#show saved properties
		today = datetime.date.today().strftime('%Y%m%d')
		self.cmbLocation.set_current_folder(os.environ['HOME'])
		self.txtIsoName.set_text('aptoncd-'+today)
		# connect signals
		self.connect_signals()
		self.window.set_modal(True)
Ejemplo n.º 4
0
    def on_cursor_changed(self, widget):
        """
            Show package's info in the top panel when a package row is selected.
        """
        iter, pkg = self.get_selected_iter()
        if pkg:
            pkgText = self.store.get_value(iter, COL_TITLE) 
            img = get_icon(pkg.package, 48)

            if pkg.bad:
                #show a grayed pixlated image
                img = utils.grayscale(img, 0.3, True)
            elif not pkg.installed:
                #show an image with some brightness
                img = utils.grayscale(img, 0.3)

            self.controller.show_selected(pkgText,img)
Ejemplo n.º 5
0
    def on_PackageList_right_click(self, widget, event):
        """ 
            This function will handle the signal to show a popup menu sent by 
            a right click on PackageList widget.
        """
        if event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS and len(self.store) > 0:
            c = contextMenu.ContextMenu(self)
            try:
                #just to make sure that something is selected
                x = int(event.x)
                y = int(event.y)
                pthinfo = widget.get_path_at_pos(x, y)
                if pthinfo is not None:
                    path, col, cellx, celly = pthinfo
                    widget.grab_focus()
                    widget.set_cursor( path, col, 0) 

                #now shows the menu with correct options    
                pkg = self.get_selected()
                c.addMenuItem(constants.MESSAGE_0009, self.menu_clicked, gtk.STOCK_YES,True)
                c.addMenuItem(constants.MESSAGE_0010, self.menu_clicked, gtk.STOCK_CANCEL, True)
                c.addMenuItem(constants.MESSAGE_0011, self.menu_clicked, None)
                if pkg.custom:
                    c.addMenuItem('-', None)
                    c.addMenuItem('',self.on_remove_clicked ,gtk.STOCK_REMOVE)

                if not pkg.installed and not pkg.bad and not pkg.old:
                    if os.path.isfile('/usr/bin/gdebi-gtk'):
                        c.addMenuItem('-', None)
                        c.addMenuItem(constants.MESSAGE_0062 , self.menu_clicked ,get_icon('deb',16), True)
                if not pkg.bad:
                    c.addMenuItem('-', None)
                    c.addMenuItem(constants.MESSAGE_0012 , self.menu_clicked ,gtk.STOCK_PROPERTIES, True)
                c.popup(None, None, None, event.button, event.get_time())
            except:
                pass
Ejemplo n.º 6
0
	def __init__(self, controller = None, burn_list = []):
		"""
			Constructor.
		"""
		
		self.controller = controller
		self.glade = gui.get_glade(constants.CREATE_GUI, WINDOW_NAME)
		
		#main widget
		self.window = gui.get_widget(self.glade, WINDOW_NAME)
		self.window.set_icon_name(constants.APP_ICON_NAME)
		self.window.set_transient_for(self.controller.get_main_window())
		self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
		
		#get work widgets
		self.labelquestion = gui.get_widget(self.glade, 'labelquestion')
		self.locationlabel = gui.get_widget(self.glade, 'locationlabel')
		self.btnyes = gui.get_widget(self.glade, 'btnyes')
		self.btnno = gui.get_widget(self.glade, 'btnno')
		self.btnclose = gui.get_widget(self.glade, 'btnclose')
		self.btnOpen = gui.get_widget(self.glade, 'btnOpenIsoLocation')
		self.burnerbox = gui.get_widget(self.glade, 'burnerbox')
		self.cmbburners = gui.get_widget(self.glade, 'cmbburners')

		self.can_burn = False
		
		if len(burn_list) > 0 :
			self.labelquestion.set_markup(constants.MESSAGE_0035)
			self.locationlabel.set_text(self.controller.get_iso_location())
			self.burnerbox.set_property('visible', True)
			self.btnclose.set_property('visible', False)
			self.can_burn = True
			
		else:
			self.burnerbox.set_property('visible', False)
			self.labelquestion.set_property('visible', False)
			self.locationlabel.set_text(self.controller.get_iso_location())
			self.btnclose.set_property('visible', True)
			self.btnyes.set_property('visible', False)
			self.btnno.set_property('visible', False)
		
		self.combo_store = gtk.ListStore(gtk.gdk.Pixbuf ,str,str,str)
		
		textcell = gtk.CellRendererText()
		textcell.set_property('xalign', 0)
		pbcell = gtk.CellRendererPixbuf()
		self.cmbburners.pack_start(pbcell, False)
		self.cmbburners.pack_start(textcell, True)
		
		self.cmbburners.add_attribute(pbcell, 'pixbuf', 0)
		self.cmbburners.add_attribute(textcell, 'text', 1)
		
		#add the burn options to the list
		for itens in burn_list.values():
			self.combo_store.append([get_icon(itens['name'], 22, True),itens['name'],itens['location'],itens['parameter']])
		
		#update the combo model
		self.cmbburners.set_model(self.combo_store)
		
		#select the first item in the combo by default
		if len(burn_list) > 0:
			self.cmbburners.set_active_iter(self.cmbburners.get_model().get_iter_first())

		gui.connect(self.btnOpen, 'clicked', self.on_open_destination)		
Ejemplo n.º 7
0
    def _create_ui(self, title, description, task):    
        """
            Create and setup widgets properties.
            
            @title is the text showed in the Window Title and progress Title.
            @description is the text showed under progress title generally informing what the process is 
               about to do.
            @the task name showed under the progress bar.
        """
        # window properties
        self.set_border_width(6)
        self.set_resizable(False)
        self.set_skip_taskbar_hint(True) #conforming to HIG, progress window must show in taskbar
        #self.set_size_request(520, 190)
        self.set_title(title)
        self.set_icon_name(constants.APP_ICON_NAME)
        self.realize()
        self.window.set_functions(gtk.gdk.FUNC_MOVE)
        
        #main box where widgets will be in
        _vbox = gtk.VBox()
        _vbox.set_border_width(6)
        self.add(_vbox)
        
        _hbox = gtk.HBox(homogeneous = False, spacing = 12)
        _vbox.pack_start(_hbox, False)
        
        _image = gtk.Image()
        _image.set_property('xalign', 0.5)
        _image.set_property('yalign', 0.0)
        _image.set_from_pixbuf(get_icon('system-search'))
        pix = gtk.gdk.PixbufAnimation(constants.MAIN_ANIMATION)
        _image.set_from_animation(pix)
        
        _hbox.pack_start(_image, expand=False, fill=True, padding=0)
        
        _vbox2 = gtk.VBox()
        _hbox.pack_start(_vbox2, expand=False, fill=True, padding=0)
        
        #Label for progress title
        self._labelTitle = _label = gtk.Label('<big><b>%s</b></big>' % title)
        _label.set_use_markup(True)
        _label.set_alignment(0.0, 0.0)
        _vbox2.pack_start(_label, expand=False, fill=True, padding=0)
        
        #Label for progress description
        self._labelDesc = _label = gtk.Label(description)
        _label.set_line_wrap(True)
        _label.set_alignment(0.5, 0.0)
        _label.set_padding(0, 12)
        _vbox2.pack_start(_label, expand=False, fill=True, padding=0)
        
        _vbox3 = gtk.VBox()
        _vbox.pack_start(_vbox3, False)
        
        self._vbox4 = gtk.VBox()
        _vbox3.pack_start(self._vbox4, False)
        
        #Progress bar widget
        self._progress = _progress = gtk.ProgressBar()
        _vbox3.pack_start(_progress, False)
        
        #text under progressbar
        self._progresstext = _label = gtk.Label('<i>%s</i>' % task)
        _label.set_use_markup(True)
        _label.set_property ("ellipsize", pango.ELLIPSIZE_END)
        _label.set_alignment(0.0, 0.0)
        _vbox3.pack_start(_label, False)
        
        #the cancel button area
        _hbbox =gtk.HButtonBox()
        _hbbox.set_border_width(5)
        _hbbox.set_layout( gtk.BUTTONBOX_END)
        _vbox.pack_start(_hbbox, False)

        #the cancel button, to make users be able to cancel the operation
        self.btnCancel = _btnCancel =gtk.Button(gtk.STOCK_CANCEL)
        _btnCancel.set_use_stock(True)
        _hbbox.pack_start(_btnCancel)
        
        _vbox.show_all()