~qcxhome/gtg/bugzilla-sync-service

« back to all changes in this revision

Viewing changes to GTG/gtk/backends_dialog/parameters_ui/__init__.py

  • Committer: Parin Porecha
  • Date: 2014-01-31 06:59:35 UTC
  • mfrom: (1240.2.94 port-to-gtk3-py3)
  • Revision ID: parinporecha@gmail.com-20140131065935-ub6evnrwpmmm25hz
Merged the gtk3 and python3 port with GTG trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
server and client
25
25
'''
26
26
 
27
 
import gtk
 
27
from gi.repository import Gtk
28
28
import functools
29
29
 
30
30
from GTG import _
37
37
from GTG.gtk.backends_dialog.parameters_ui.pathui import PathUI
38
38
 
39
39
 
40
 
class ParametersUI(gtk.VBox):
 
40
class ParametersUI(Gtk.Box):
41
41
    '''
42
 
    Given a bakcend, this gtk.VBox populates itself with all the necessary
 
42
    Given a bakcend, this vertical Gtk.Box populates itself with all the
 
43
    necessary
43
44
    widgets to view and edit a backend configuration
44
45
    '''
45
46
 
50
51
 
51
52
        @param requester: a GTG.core.requester.Requester object
52
53
        '''
53
 
        super(ParametersUI, self).__init__(False)
 
54
        super(ParametersUI, self).__init__(
 
55
            False, orientation=Gtk.Orientation.VERTICAL)
54
56
        self.req = requester
55
57
        self.set_spacing(10)
56
58
 
98
100
            })),
99
101
            ("tag-with-project-name", self.UI_generator(CheckBoxUI, {
100
102
                "text": _("Tag your GTG tasks with the project "
101
 
                     "targeted by the bug"),
 
103
                          "targeted by the bug"),
102
104
                "parameter": "tag-with-project-name",
103
105
            })),
104
106
        )
127
129
        @param backend: the backend that is being configured
128
130
        '''
129
131
        # remove the old parameters UIs
130
 
        def _remove_child(self, child):
 
132
        def _remove_child(self, child, data=None):
131
133
            self.remove(child)
132
 
        self.foreach(functools.partial(_remove_child, self))
 
134
        self.foreach(functools.partial(_remove_child, self), None)
133
135
        # add new widgets
134
136
        backend_parameters = backend.get_parameters()
135
137
        if backend_parameters[GenericBackend.KEY_DEFAULT_BACKEND]:
137
139
            return
138
140
        for parameter_name, widget in self.parameter_widgets:
139
141
            if parameter_name in backend_parameters:
140
 
                self.pack_start(widget(backend), True)
 
142
                #FIXME I am not 100% about this change
 
143
                self.pack_start(widget(backend), True, True, 0)
141
144
        self.show_all()
142
145
 
143
146
    def commit_changes(self):
146
149
        modified them)
147
150
        '''
148
151
 
149
 
        def _commit_changes(child):
 
152
        def _commit_changes(child, data=None):
150
153
            child.commit_changes()
151
 
        self.foreach(_commit_changes)
 
154
        self.foreach(_commit_changes, None)