~marcosvanetta/stipple/stipple-sensitive

« back to all changes in this revision

Viewing changes to core/stipple.py

  • Committer: duanedesign
  • Date: 2010-05-07 02:40:15 UTC
  • Revision ID: duanedesign@gmail.com-20100507024015-sa8t3yq0h8u385dr
patch fixing bug LP 575903

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
"""
9
9
 
10
 
__version__ = "$Revision$"
11
 
 
12
10
import pygtk
13
11
pygtk.require('2.0')
14
12
import gtk
17
15
import apt
18
16
import shutil
19
17
from core.db import Database
20
 
  
 
18
 
 
19
class PluginBase(object):  
 
20
    value = False
 
21
    
21
22
class Window:
22
23
 
23
24
    def callback_o (self, widget, data=None):
24
 
        """ Function doc """
25
 
        d = ("off", "on")[widget.get_active()]
26
 
        print data.name + " " + str(d)
 
25
        """ Change the value method of each plugin. 
 
26
        """
 
27
        #d = ("off", "on")[widget.get_active()]
 
28
        #print data.name + " " + str(d)
27
29
        self.value = widget.get_active()
 
30
        data.value = widget.get_active()
28
31
        
29
32
        
30
33
    def backup_click(self, widget, data=None):
 
34
        """ It's call for every sync() method on each plugin that has
 
35
        the value = True        
 
36
        """
31
37
        for op in self.options:
32
38
            print op.name
33
 
            if self.value:
 
39
            if op.value:
34
40
                op.sync()
35
 
            else:
36
 
                pass
37
41
 
38
42
    def restore_click(self, widget, data=None):
39
 
        for op in self.options:
 
43
        for op in self.options:                
40
44
            print op.name
41
 
            if self.value:
 
45
            if op.value:
42
46
                op.restore()
43
 
            else:
44
 
                pass
45
 
                
 
47
 
46
48
    def delete_event(self, widget, event, data=None):
47
49
        gtk.main_quit()
48
50
        return False
81
83
        gtk.main()
82
84
 
83
85
def loadPlugins():
84
 
    """ Function doc """
 
86
    """ Search for every *.py file, (except for: __init__.py and *.pyc)
 
87
    From each file, it's takes Plugin Class, instance it and retunr in
 
88
    in a list.
 
89
    """
85
90
    objetos = []
86
 
    files = (os.listdir("./plugins"))#.sort()
 
91
    files = (os.listdir("./plugins"))
87
92
    files.sort()
88
93
    for arch in files:
89
94
        if arch.startswith("_") or arch.endswith("pyc"):
90
95
            continue
91
96
        mod = __import__("plugins." + arch.split(".")[0])
92
97
        mod = getattr(mod, arch.split(".")[0])
93
 
        #print mod #debug
94
98
        objetos.append(mod.Plugin())
95
 
        #print objetos #debug
96
99
    return objetos
97
100
    
98
101
def run():