Debian Codegraph @

lib/sysinfo.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 #
3 # QBrz - Qt frontend to Breezy commands
4 # Copyright (C) 2009 Canonical Ltd
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 from breezy.plugins.qbrz.lib.i18n import gettext
21 from breezy.plugins.qbrz.lib.sysinfo_data import get_sys_info
22 from breezy.plugins.qbrz.lib.ui_sysinfo import Ui_MainWindow
23 from breezy.plugins.qbrz.lib.util import BTN_CLOSE, QBzrWindow
24
25
26 # RJLRJL check these for bzr / brz issues
27
28 class QBzrSysInfoWindow(QBzrWindow):
29
30 def __init__(self, parent=None):
31 QBzrWindow.__init__(self, [], parent)
32 self.ui = Ui_MainWindow()
33 self.ui.setupUi(self)
34 self.set_title(gettext("System Information"))
35 self.restoreSize("sysinfo", (400,256))
36 btns = self.create_button_box(BTN_CLOSE)
37 self.ui.vboxlayout.addWidget(btns)
38 self.display_sys_info(get_sys_info())
39
40 def display_sys_info(self, props):
41 """Update the view.
42
43 :param props: a dictionary mapping field names to values.
44 """
45 # Bazaar Library section
46 self.ui.bzr_version.setText(props.get("bzr-version", "?"))
47 breezy_path = props.get("bzr-lib-path")
48 try:
49 breezy_head = breezy_path[0]
50 except IndexError:
51 breezy_head = ""
52 self.ui.bzr_lib_path.setText(breezy_head)
53
54 # Bazaar Configuration section
55 self.ui.bzr_config_dir.setText(props.get("brz-config-dir", "?"))
56 self.ui.bzr_log_file.setText(props.get("brz-log-file", "?"))
57
58 # Python Interpreter section
59 self.ui.python_version.setText(props.get("python-version", "?"))
60 self.ui.python_file.setText(props.get("python-file", "?"))
61 self.ui.python_lib_dir.setText(props.get("python-lib-dir", "?"))