/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-09-11 02:56:58 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-20060911025658-997cf3a305b9f1da
A better implementation for the drive selection. (OptionMenu didn't work on Win32)

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
                "on_treeview_right_button_press_event": handler.on_treeview_right_button_press_event,
100
100
                "on_treeview_right_row_activated": handler.on_treeview_right_row_activated,
101
101
                "on_treeview_left_button_press_event": handler.on_treeview_left_button_press_event,
102
 
                "on_treeview_left_row_activated": handler.on_treeview_left_row_activated,
103
 
                "on_drive_a_activate": handler.on_drive_activate,
104
 
                "on_drive_b_activate": handler.on_drive_activate,
105
 
                "on_drive_c_activate": handler.on_drive_activate,
106
 
                "on_drive_d_activate": handler.on_drive_activate,
107
 
                "on_drive_e_activate": handler.on_drive_activate,
108
 
                "on_drive_f_activate": handler.on_drive_activate,
109
 
                "on_drive_g_activate": handler.on_drive_activate,
110
 
                "on_drive_h_activate": handler.on_drive_activate,
111
 
                "on_drive_i_activate": handler.on_drive_activate,
112
 
                "on_drive_j_activate": handler.on_drive_activate,
113
 
                "on_drive_k_activate": handler.on_drive_activate,
114
 
                "on_drive_l_activate": handler.on_drive_activate,
115
 
                "on_drive_m_activate": handler.on_drive_activate,
116
 
                "on_drive_n_activate": handler.on_drive_activate,
117
 
                "on_drive_o_activate": handler.on_drive_activate,
118
 
                "on_drive_p_activate": handler.on_drive_activate,
119
 
                "on_drive_q_activate": handler.on_drive_activate,
120
 
                "on_drive_r_activate": handler.on_drive_activate,
121
 
                "on_drive_s_activate": handler.on_drive_activate,
122
 
                "on_drive_t_activate": handler.on_drive_activate,
123
 
                "on_drive_u_activate": handler.on_drive_activate,
124
 
                "on_drive_v_activate": handler.on_drive_activate,
125
 
                "on_drive_w_activate": handler.on_drive_activate,
126
 
                "on_drive_x_activate": handler.on_drive_activate,
127
 
                "on_drive_y_activate": handler.on_drive_activate,
128
 
                "on_drive_z_activate": handler.on_drive_activate }
 
102
                "on_treeview_left_row_activated": handler.on_treeview_left_row_activated }
129
103
        
130
104
        # Connect the signals to the handlers
131
105
        self.toplevel.signal_autoconnect(dic)
150
124
        
151
125
        # Show drive selector if under Win32
152
126
        if sys.platform == 'win32':
 
127
            self.comm.vbox_main_right.pack_start(self.comm.combobox_drive, False, True, 0)
 
128
            self.comm.vbox_main_right.reorder_child(self.comm.combobox_drive, 0)
 
129
            self.comm.combobox_drive.show()
153
130
            self.comm.gen_hard_selector()
154
 
            self.comm.optionmenu_drive.show()
155
131
        
156
132
        # Load default data into the panels
157
133
        self.treeview_left = self.toplevel.get_widget('treeview_left')
365
341
        self.toolbutton_pull = self.toplevel.get_widget('toolbutton_pull')
366
342
        self.toolbutton_push = self.toplevel.get_widget('toolbutton_push')
367
343
        # Get the drive selector
368
 
        self.optionmenu_drive = self.toplevel.get_widget('optionmenu_drive')
 
344
        self.combobox_drive = gtk.combo_box_new_text()
 
345
        self.combobox_drive.connect("changed", self._refresh_drives)
 
346
        
 
347
        self.vbox_main_right = self.toplevel.get_widget('vbox_main_right')
369
348
    
370
349
    def set_path(self, path):
371
350
        """ Set the current path while browsing the directories. """
551
530
 
552
531
        gtk.main_iteration(0)
553
532
 
554
 
    def harddisks(self):
 
533
    def _harddisks(self):
555
534
        """ Returns hard drive letters under Win32. """
556
535
        try:
557
536
            import win32file
565
544
        
566
545
        driveletters = []
567
546
        for drive in string.ascii_uppercase:
568
 
            if win32file.GetDriveType(drive) == win32file.DRIVE_FIXED:
569
 
                driveletters.append(drive)
 
547
            if win32file.GetDriveType(drive+':') == win32file.DRIVE_FIXED:
 
548
                driveletters.append(drive+':')
570
549
        return driveletters
571
550
    
572
551
    def gen_hard_selector(self):
573
552
        """ Generate the hard drive selector under Win32. """
574
 
        import string
575
 
        drives = self.harddisks()
576
 
        for drive in string.ascii_uppercase:
577
 
            if drive not in drives:
578
 
                self.toplevel.get_widget(drive).destroy()
 
553
        drives = self._harddisks()
 
554
        for drive in drives:
 
555
            self.combobox_drive.append_text(drive)
 
556
    
 
557
    def _refresh_drives(self, combobox):
 
558
        model = combobox.get_model()
 
559
        active = combobox.get_active()
 
560
        if active >= 0:
 
561
            drive = model[active][0]
 
562
            self.refresh_right(drive + '\\')
579
563
 
580
564
class OlivePreferences:
581
565
    """ A class which handles Olive's preferences. """