~marcosvanetta/stipple/stipple-new-pluginbase

« back to all changes in this revision

Viewing changes to core/stipple.py

  • Committer: Marcos Vanetta
  • Date: 2010-05-10 19:03:33 UTC
  • Revision ID: marcosvanetta@gmail.com-20100510190333-4jjsbhh0g6gooyay
it checks first if tthe package is installed when building the GUI

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
import shutil
17
17
from core.db import Database
18
18
 
 
19
cache = apt.Cache()
 
20
 
19
21
class PluginBase(object):  
20
22
    value = False
21
23
    
 
24
    def isInstalled(self):
 
25
        """ It search on the apt list if the package is installed"""
 
26
        try:
 
27
            cache[(self.name).lower()]
 
28
            return True
 
29
        except:
 
30
            return False
 
31
    
22
32
class Window:
23
33
 
24
34
    def callback_o (self, widget, data=None):
59
69
        # Loading the buttons
60
70
        for op in options:
61
71
            button = gtk.CheckButton(op.name)
62
 
#            button.available = False
63
72
            button.connect("toggled", self.callback_o, op)
64
73
            vbox.pack_start(button, True, True, 0)
 
74
            if not op.isInstalled():
 
75
                button.set_sensitive(False)
65
76
            button.show()
66
77
        
67
78
        ##Run Command Button ##