/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/frontend/gtk/__init__.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-07-18 15:33:52 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060718153352-2f5f03d4b618d41a
2006-07-18  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive/backend/init.py: added NotBranchError handling to branch()
    * olive/frontend/gtk/__init__.py: added OliveCommunication class
    * olive/frontend/gtk/branch.py: finished implementation of Branch window

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
import os
 
18
import os.path
17
19
import sys
18
20
 
19
21
try:
37
39
    program."""
38
40
    
39
41
    def __init__(self):
40
 
        import os.path
41
 
        
42
42
        # Load the glade file
43
43
        self.gladefile = "/usr/share/olive/olive.glade"
44
44
        if not os.path.exists(self.gladefile):
50
50
        self.window = self.toplevel.get_widget('window_main')
51
51
        self.window.show_all()
52
52
        
53
 
        handler = OliveHandler(self.gladefile)
 
53
        self.comm = OliveCommunicator(self.toplevel)
 
54
        handler = OliveHandler(self.gladefile, self.comm)
54
55
        
55
56
        # Dictionary for signal_autoconnect
56
57
        dic = { "on_window_main_destroy": gtk.main_quit,
75
76
        
76
77
    def _load_right(self):
77
78
        """ Load data into the right panel. (Filelist) """
78
 
        import os
79
 
        import os.path
80
 
        
81
79
        import olive.backend.fileops as fileops
82
80
        
83
81
        # Create ListStore
87
85
        files = []
88
86
        
89
87
        # Fill the appropriate lists
90
 
        for item in os.listdir('.'):
 
88
        for item in os.listdir(self.comm.get_path()):
91
89
            if os.path.isdir(item):
92
90
                dirs.append(item)
93
91
            else:
120
118
        tvcolumn_filename.add_attribute(cell, 'text', 1)
121
119
        tvcolumn_status.pack_start(cell, True)
122
120
        tvcolumn_status.add_attribute(cell, 'text', 2)
 
121
 
 
122
class OliveCommunicator:
 
123
    """ This class is responsible for the communication between the different
 
124
    modules. """
 
125
    def __init__(self, toplevel):
 
126
        # Get glade main component
 
127
        self.toplevel = toplevel
 
128
        # Default path
 
129
        self._path = os.getcwd()
 
130
        
 
131
        # Initialize the statusbar
 
132
        self.statusbar = self.toplevel.get_widget('statusbar')
 
133
        self.context_id = self.statusbar.get_context_id('olive')
 
134
    
 
135
    def set_path(self, path):
 
136
        """ Set the current path while browsing the directories. """
 
137
        self._path = path
 
138
    
 
139
    def get_path(self):
 
140
        """ Get the current path. """
 
141
        return self._path
 
142
 
 
143
    def set_statusbar(self, message):
 
144
        """ Set the statusbar message. """
 
145
        self.statusbar.push(self.context_id, message)
 
146
    
 
147
    def clear_statusbar(self):
 
148
        """ Clean the last message from the statusbar. """
 
149
        self.statusbar.pop(self.context_id)
 
150
    
 
151
    def refresh_right(self):
 
152
        """ Refresh the file list. """
 
153
        pass