diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-26 10:43:34 +0200 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-26 10:43:34 +0200 |
commit | a88dce13d510622dee05e93efb46ff4ec5b72935 (patch) | |
tree | 5159e913ad91b70bb7c57946f4092bd69330f1d9 /src/Gui | |
parent | 7b6c533525e26cc3408865f1c90c71882384cf76 (diff) | |
download | abrt-a88dce13d510622dee05e93efb46ff4ec5b72935.tar.gz abrt-a88dce13d510622dee05e93efb46ff4ec5b72935.tar.xz abrt-a88dce13d510622dee05e93efb46ff4ec5b72935.zip |
GUI: added support for gettext (+part of czech translation)
Diffstat (limited to 'src/Gui')
-rw-r--r-- | src/Gui/ABRTExceptions.py | 10 | ||||
-rw-r--r-- | src/Gui/CCDBusBackend.py | 11 | ||||
-rw-r--r-- | src/Gui/CCMainWindow.py | 42 | ||||
-rw-r--r-- | src/Gui/CCReporterDialog.py | 3 | ||||
-rw-r--r-- | src/Gui/Makefile.am | 4 | ||||
-rw-r--r-- | src/Gui/PluginSettingsUI.py | 12 | ||||
-rw-r--r-- | src/Gui/SettingsDialog.py | 13 | ||||
-rw-r--r-- | src/Gui/ccgui.glade | 190 |
8 files changed, 45 insertions, 240 deletions
diff --git a/src/Gui/ABRTExceptions.py b/src/Gui/ABRTExceptions.py index 5f759dd2..9b1aa32c 100644 --- a/src/Gui/ABRTExceptions.py +++ b/src/Gui/ABRTExceptions.py @@ -1,6 +1,14 @@ +from abrt_utils import _ class IsRunning(Exception): def __init__(self): - self.what = "Another client is already running, trying to wake it." + self.what = _("Another client is already running, trying to wake it.") + def __str__(self): + return self.what + +class WrongData(Exception): + def __init__(self): + self.what = _("Got unexpected data from daemon (is the database properly updated?).") + def __str__(self): return self.what diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py index 42b4d59a..5af5c540 100644 --- a/src/Gui/CCDBusBackend.py +++ b/src/Gui/CCDBusBackend.py @@ -6,6 +6,7 @@ from dbus.mainloop.glib import DBusGMainLoop import gtk from dbus.exceptions import * import ABRTExceptions +from abrt_utils import _ CC_NAME = 'com.redhat.abrt' CC_IFACE = 'com.redhat.abrt' @@ -131,11 +132,11 @@ class DBusManager(gobject.GObject): self.bus.add_signal_receiver(self.owner_changed_cb,"NameOwnerChanged", dbus_interface="org.freedesktop.DBus") self.uniq_name = self.bus.get_unique_name() if not self.bus: - raise Exception("Can't connect to dbus") + raise Exception(_("Can't connect to dbus")) if self.bus.name_has_owner(CC_NAME): self.proxy = self.bus.get_object(CC_IFACE, CC_PATH) else: - raise Exception("Please check if abrt daemon is running.") + raise Exception(_("Please check if abrt daemon is running.")) if self.proxy: self.cc = dbus.Interface(self.proxy, dbus_interface=CC_IFACE) @@ -153,7 +154,7 @@ class DBusManager(gobject.GObject): # watch for job-done signals self.acconnection = self.proxy.connect_to_signal("JobDone",self.jobdone_cb,dbus_interface=CC_IFACE) else: - raise Exception("Please check if abrt daemon is running.") + raise Exception(_("Please check if abrt daemon is running.")) def addJob(self, job_id): pass @@ -165,7 +166,7 @@ class DBusManager(gobject.GObject): if dump: self.emit("analyze-complete", dump) else: - self.emit("abrt-error","Daemon did't return valid report info\nDebuginfo is missing?") + self.emit("abrt-error",_("Daemon did't return valid report info\nDebuginfo is missing?")) def report_done(self, result): self.emit("report-done", result) @@ -182,7 +183,7 @@ class DBusManager(gobject.GObject): def Report(self,report): # map < Plguin_name vec <status, message> > self.cc.Report(report, reply_handler=self.report_done, error_handler=self.error_handler_cb, timeout=60) - + def DeleteDebugDump(self,UUID): return self.cc.DeleteDebugDump(UUID) diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index d36eb734..d1eaff73 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -13,8 +13,8 @@ from CCDumpList import getDumpList, DumpList from CCReporterDialog import ReporterDialog from SettingsDialog import SettingsDialog from CCReport import Report -from exception import installExceptionHandler, handleMyException import ABRTExceptions +from abrt_utils import _ try: import rpm @@ -22,22 +22,6 @@ except Exception, ex: rpm = None -PROGNAME = "abrt" -import locale -try: - locale.setlocale (locale.LC_ALL, "") -except locale.Error, e: - import os - os.environ['LC_ALL'] = 'C' - locale.setlocale (locale.LC_ALL, "") -import gettext -gettext.bind_textdomain_codeset(PROGNAME,locale.nl_langinfo(locale.CODESET)) -gettext.bindtextdomain(PROGNAME, '/usr/share/locale') -gettext.textdomain(PROGNAME) -_ = lambda x: gettext.lgettext(x) - -#installExceptionHandler("abrt-gui", "0.0.7") - class MainWindow(): ccdaemon = None def __init__(self): @@ -99,12 +83,12 @@ class MainWindow(): icon_column.set_attributes(icon_column.cell, pixbuf=(n-1), cell_background_set=5) # =============================================== columns = [None]*4 - columns[0] = gtk.TreeViewColumn('Package') - columns[1] = gtk.TreeViewColumn('Application') - columns[2] = gtk.TreeViewColumn('Date') - columns[3] = gtk.TreeViewColumn('Crash Rate') + columns[0] = gtk.TreeViewColumn(_("Package")) + columns[1] = gtk.TreeViewColumn(_("Application")) + columns[2] = gtk.TreeViewColumn(_("Date")) + columns[3] = gtk.TreeViewColumn(_("Crash Rate")) if os.getuid() == 0: - column = gtk.TreeViewColumn('User') + column = gtk.TreeViewColumn(_("User")) columns.append(column) # create list for column in columns: @@ -169,7 +153,7 @@ class MainWindow(): self.pBarWindow.hide() except Exception, e: pass - gui_error_message("Unable to get report!\n%s" % message,parent_dialog=self.window) + gui_error_message(_("Unable to get report!\n%s" % message),parent_dialog=self.window) def update_cb(self, daemon, message): message = message.replace('\n',' ') @@ -186,7 +170,7 @@ class MainWindow(): try: dumplist = getDumpList(self.ccdaemon, refresh=True) except Exception, e: - gui_error_message("Error while loading the dumplist, please check if abrt daemon is running\n %s" % e) + gui_error_message(_("Error while loading the dumplist, please check if abrt daemon is running\n %s" % e)) for entry in dumplist: try: icon = get_icon_for_package(self.theme, entry.getPackageName()) @@ -219,7 +203,7 @@ class MainWindow(): dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]), dumpsListStore.get_n_columns()-1) #move this to Dump class if dump.isReported(): - report_label = "<b>This crash has been reported, you can find the report(s) at:</b>\n" + report_label = _("<b>This crash has been reported, you can find the report(s) at:</b>\n") for message in dump.getMessage().split('\n'): if message: if "http" in message or "file:///" in message: @@ -227,7 +211,7 @@ class MainWindow(): report_label += "%s\n" % message self.wTree.get_widget("lReported").set_markup(report_label) else: - self.wTree.get_widget("lReported").set_markup("<b>Not reported!</b>") + self.wTree.get_widget("lReported").set_markup(_("<b>Not reported!</b>")) lPackage = self.wTree.get_widget("lPackage") self.wTree.get_widget("lDescription").set_label(dump.getDescription()) @@ -279,7 +263,7 @@ class MainWindow(): # except Exception, e: # print e if not report: - gui_error_message("Unable to get report!\nDebuginfo is missing?") + gui_error_message(_("Unable to get report!\nDebuginfo is missing?")) return report_dialog = ReporterDialog(report) result = report_dialog.run() @@ -291,7 +275,7 @@ class MainWindow(): self.ccdaemon.Report(result) #self.hydrate() except Exception, e: - gui_error_message("Reporting failed!\n%s" % e) + gui_error_message(_("Reporting failed!\n%s" % e)) #ret = gui_question_dialog("GUI: Analyze for package %s crash with UUID %s is complete" % (entry.Package, UUID),self.window) #if ret == gtk.RESPONSE_YES: # self.hydrate() @@ -319,7 +303,7 @@ class MainWindow(): if self.timer: gobject.source_remove(self.timer) self.pBarWindow.hide() - gui_error_message("Error getting the report: %s" % e) + gui_error_message(_("Error getting the report: %s" % e)) return def sw_delete_event_cb(self, widget, event, data=None): diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py index b83ac61c..bae5cf72 100644 --- a/src/Gui/CCReporterDialog.py +++ b/src/Gui/CCReporterDialog.py @@ -9,6 +9,7 @@ from CC_gui_functions import * from CCReport import Report import CellRenderers #from CCDumpList import getDumpList, DumpList +from abrt_utils import _ # FIXME - create method or smth that returns type|editable|content TYPE = 0 @@ -99,7 +100,7 @@ class ReporterDialog(): for item in self.report: if item == "Comment": buff = gtk.TextBuffer() - buff.set_text("Brief description how to reproduce this or what you did...") + buff.set_text(_("Brief description how to reproduce this or what you did...")) self.tvComment.set_buffer(buff) continue if self.report[item][TYPE] != 's': diff --git a/src/Gui/Makefile.am b/src/Gui/Makefile.am index fd48c7f2..6435c1f0 100644 --- a/src/Gui/Makefile.am +++ b/src/Gui/Makefile.am @@ -3,8 +3,8 @@ bin_SCRIPTS = abrt-gui PYTHON_FILES = CCDBusBackend.py CCDumpList.py CCDump.py CC_gui_functions.py \ - CCReporterDialog.py CCReport.py \ - CCMainWindow.py exception.py CellRenderers.py ABRTExceptions.py \ + CCReporterDialog.py CCReport.py abrt_utils.py \ + CCMainWindow.py CellRenderers.py ABRTExceptions.py \ SettingsDialog.py ABRTPlugin.py PluginList.py PluginSettingsUI.py GLADE_FILES = ccgui.glade report.glade settings.GtkBuilder dialogs.GtkBuilder diff --git a/src/Gui/PluginSettingsUI.py b/src/Gui/PluginSettingsUI.py index dfcda151..02c03171 100644 --- a/src/Gui/PluginSettingsUI.py +++ b/src/Gui/PluginSettingsUI.py @@ -1,5 +1,5 @@ import gtk - +from abrt_utils import _ class PluginSettingsUI(gtk.Dialog): def __init__(self, pluginfo): #print "Init PluginSettingsUI" @@ -14,11 +14,11 @@ class PluginSettingsUI(gtk.Dialog): self.plugin_gui.add_from_file(pluginfo.getGUI()) self.dialog = self.plugin_gui.get_object("PluginDialog") if not self.dialog: - raise Exception("Can't find PluginDialog widget in UI description!") + raise Exception(_("Can't find PluginDialog widget in UI description!")) self.dialog.set_title("%s" % pluginfo.getName()) else: # we shouldn't get here, but just to be safe - no_ui_label = gtk.Label("No UI for plugin %s" % pluginfo) + no_ui_label = gtk.Label(_("No UI for plugin %s" % pluginfo)) self.add(no_ui_label) no_ui_label.show() @@ -35,7 +35,7 @@ class PluginSettingsUI(gtk.Dialog): elif type(widget) == gtk.CheckButton: widget.set_active(value == "yes") elif type(widget) == gtk.ComboBox: - print "combo box is not implemented" + print _("combo box is not implemented") else: #print "Plugin %s has no configuration." % self.plugin_name pass @@ -44,7 +44,7 @@ class PluginSettingsUI(gtk.Dialog): pass else: - print "Nothing to hydrate!" + print _("Nothing to hydrate!") def dehydrate(self): #print "dehydrating %s" % self.pluginfo.getName() @@ -61,7 +61,7 @@ class PluginSettingsUI(gtk.Dialog): else: self.Settings[key] = "no" elif type(widget) == gtk.ComboBox: - print "combo box is not implemented" + print _("combo box is not implemented") def destroy(self): self.dialog.destroy() diff --git a/src/Gui/SettingsDialog.py b/src/Gui/SettingsDialog.py index a16a776b..33a89234 100644 --- a/src/Gui/SettingsDialog.py +++ b/src/Gui/SettingsDialog.py @@ -4,6 +4,7 @@ from PluginList import getPluginInfoList, PluginInfoList from CC_gui_functions import * from PluginSettingsUI import PluginSettingsUI from ABRTPlugin import PluginSettings +from abrt_utils import _ class SettingsDialog: def __init__(self, parent, daemon): @@ -18,7 +19,7 @@ class SettingsDialog: print e self.window = self.builder.get_object("wSettings") if not self.window: - raise Exception("Can't load gui description for SettingsDialog!") + raise Exception(_("Can't load gui description for SettingsDialog!")) #self.window.set_parent(parent) self.pluginlist = self.builder.get_object("tvSettings") @@ -29,7 +30,7 @@ class SettingsDialog: self.pluginlist.set_model(self.modelfilter) # =============================================== columns = [None]*1 - columns[0] = gtk.TreeViewColumn('Name') + columns[0] = gtk.TreeViewColumn(_("Name")) # create list for column in columns: @@ -43,7 +44,7 @@ class SettingsDialog: toggle_renderer = gtk.CellRendererToggle() toggle_renderer.set_property('activatable', True) toggle_renderer.connect( 'toggled', self.on_enabled_toggled, self.pluginsListStore ) - column = gtk.TreeViewColumn('Enabled', toggle_renderer) + column = gtk.TreeViewColumn(_('Enabled'), toggle_renderer) column.add_attribute( toggle_renderer, "active", 1) self.pluginlist.insert_column(column, 0) @@ -102,7 +103,7 @@ class SettingsDialog: try: ui = PluginSettingsUI(pluginfo) except Exception, e: - gui_error_message("Error while opening plugin settings UI: \n\n%s" % e) + gui_error_message(_("Error while opening plugin settings UI: \n\n%s" % e)) return ui.hydrate() response = ui.run() @@ -112,13 +113,13 @@ class SettingsDialog: try: self.ccdaemon.setPluginSettings(pluginfo.getName(), pluginfo.Settings) except Exception, e: - gui_error_message("Can't save plugin settings:\n %s", e) + gui_error_message(_("Can't save plugin settings:\n %s", e)) #for key, val in pluginfo.Settings.iteritems(): # print "%s:%s" % (key, val) elif response == gtk.RESPONSE_CANCEL: pass else: - print "unknown response from settings dialog" + print _("unknown response from settings dialog") ui.destroy() def on_bClose_clicked(self, button): diff --git a/src/Gui/ccgui.glade b/src/Gui/ccgui.glade index 80655ff5..7b8dd244 100644 --- a/src/Gui/ccgui.glade +++ b/src/Gui/ccgui.glade @@ -2,196 +2,6 @@ <glade-interface> <!-- interface-requires gtk+ 2.14 --> <!-- interface-naming-policy toplevel-contextual --> - <widget class="GtkWindow" id="main_window2"> - <property name="title" translatable="yes">Automatic Bug Reporting Tool</property> - <property name="window_position">center</property> - <child> - <widget class="GtkVBox" id="vbox4"> - <property name="visible">True</property> - <child> - <widget class="GtkMenuBar" id="menubar2"> - <property name="visible">True</property> - <child> - <widget class="GtkMenuItem" id="menuitem5"> - <property name="visible">True</property> - <property name="label" translatable="yes">_File</property> - <property name="use_underline">True</property> - <child> - <widget class="GtkMenu" id="menu4"> - <property name="visible">True</property> - <child> - <widget class="GtkImageMenuItem" id="miQuit"> - <property name="label">gtk-quit</property> - <property name="visible">True</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GtkMenuItem" id="edit"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Edit</property> - <property name="use_underline">True</property> - <child> - <widget class="GtkMenu" id="menu1"> - <property name="visible">True</property> - <child> - <widget class="GtkImageMenuItem" id="miPreferences"> - <property name="label">gtk-preferences</property> - <property name="visible">True</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GtkMenuItem" id="menuitem8"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Help</property> - <property name="use_underline">True</property> - <child> - <widget class="GtkMenu" id="menu6"> - <property name="visible">True</property> - <child> - <widget class="GtkImageMenuItem" id="miAbout"> - <property name="label">gtk-about</property> - <property name="visible">True</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkToolbar" id="toolbar1"> - <property name="visible">True</property> - <child> - <widget class="GtkToolButton" id="bDelete"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="label" translatable="yes">Delete</property> - <property name="stock_id">gtk-delete</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <widget class="GtkToolButton" id="bReport"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="label" translatable="yes">Report</property> - <property name="stock_id">gtk-save</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <widget class="GtkSeparatorToolItem" id="toolbutton1"> - <property name="visible">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <widget class="GtkScrolledWindow" id="swDumps"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <child> - <widget class="GtkTreeView" id="tvDumps"> - <property name="visible">True</property> - <property name="can_focus">True</property> - </widget> - </child> - </widget> - <packing> - <property name="position">2</property> - </packing> - </child> - <child> - <widget class="GtkEventBox" id="evDescription"> - <property name="visible">True</property> - <child> - <widget class="GtkLabel" id="Description"> - <property name="visible">True</property> - <property name="xalign">0.05000000074505806</property> - <property name="label" translatable="yes"><span color="white">Description</span></property> - <property name="use_markup">True</property> - </widget> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">3</property> - </packing> - </child> - <child> - <widget class="GtkScrolledWindow" id="swDesscription"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <child> - <widget class="GtkViewport" id="vDescription"> - <property name="visible">True</property> - <property name="resize_mode">queue</property> - <child> - <widget class="GtkLabel" id="lDescription"> - <property name="visible">True</property> - <property name="xalign">0.10000000149011612</property> - <property name="yalign">0.20000000298023224</property> - <property name="justify">fill</property> - <property name="selectable">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="position">4</property> - </packing> - </child> - <child> - <widget class="GtkStatusbar" id="statusbar1"> - <property name="visible">True</property> - <property name="spacing">2</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">5</property> - </packing> - </child> - </widget> - </child> - </widget> <widget class="GtkWindow" id="pBarWindow"> <property name="title" translatable="yes">Please wait..</property> <property name="modal">True</property> |