~ubuntu-branches/ubuntu/precise/mythbuntu-control-centre/precise

« back to all changes in this revision

Viewing changes to mythbuntu-control-centre

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2009-11-27 17:28:59 UTC
  • mfrom: (1.1.45 upstream)
  • Revision ID: james.westby@ubuntu.com-20091127172859-wse1esbamxjtv7oj
Tags: 0.59-0ubuntu1
Introduce a "single" plugin mode.  This allows a plugin to be launched
without allowing switching to other plugins in the UI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
class ControlCentre():
52
52
 
53
 
    def __init__(self,debug,plugin_root_path):
 
53
    def __init__(self,debug,plugin_root_path,single):
54
54
        """Initalizes the different layers of the Control Centre:
55
55
           Top Level GUI
56
56
           Plugins
108
108
            self.mythbuntu_common.show()
109
109
            self.install.append('mythbuntu-common')
110
110
 
 
111
        #If we are running in single plugin mode, we'll change a few things
 
112
        if single:
 
113
            found=False
 
114
            for plugin in self.plugins:
 
115
                if plugin.getInformation('name') == single:
 
116
                    found=True
 
117
                    self.togglePlugin(single)
 
118
                    break
 
119
            if found:
 
120
                self.button_scrolledwindow.hide()
 
121
                self.main_window.set_size_request(-1,-1)
 
122
                self.main_window.set_title('Mythbuntu ' + single)
 
123
 
111
124
        #Connect signals and enable GUI
112
 
 
113
125
        self.main_window.show()
114
126
 
115
127
        #set up dbus
149
161
            self.main_apply_button.show()
150
162
        if not self.refresh_button.get_properties('visible')[0]:
151
163
            self.refresh_button.show()
152
 
        #actually switch pages in the notebook
153
 
        for child in widget.get_children():
154
 
            for grandchild in child.get_children():
155
 
                if type(grandchild) == gtk.Label:
156
 
                    label = grandchild.get_text()
 
164
 
 
165
        #determine where we are called from (maybe single mode)
 
166
        if type(widget) == str:
 
167
            label = widget
 
168
        else:
 
169
            #actually switch pages in the notebook
 
170
            for child in widget.get_children():
 
171
                for grandchild in child.get_children():
 
172
                    if type(grandchild) == gtk.Label:
 
173
                        label = grandchild.get_text()
157
174
        plugin = self.index[label]
158
175
        self.tabs.set_current_page(plugin)
159
176
 
432
449
    parser.add_option ('-l', '--logfile', type='string', metavar='FILE',
433
450
        dest='logfile', default=None,
434
451
        help=_('Write logging messages to a file instead to stderr.'))
435
 
 
 
452
    parser.add_option ('-s', '--single' , type='string', dest='single', default=None,
 
453
        help=_('Run in single plugin mode. '))
436
454
    (opts, args) = parser.parse_args()
437
455
    return (opts, args)
438
456
 
452
470
    setup_logging(argv_options.debug, argv_options.logfile)
453
471
 
454
472
    cc = ControlCentre(argv_options.debug,
455
 
                       argv_options.plugin_root_path)
 
473
                       argv_options.plugin_root_path,
 
474
                       argv_options.single)