def __init__(self, parent): GObject.GObject.__init__(self) self.set_title(_("About NFO Viewer")) self.set_transient_for(parent) self.set_authors(("Osmo Salomaa <*****@*****.**>", )) self.set_comments(_("Viewer for NFO files")) self.set_copyright("Copyright © 2005–2020 Osmo Salomaa") self.set_license_type(Gtk.License.GPL_3_0) self.set_logo_icon_name("io.otsaloma.nfoview") # TRANSLATORS: The application name "NFO Viewer" has been intentionally # marked as translatable. If you manage to translate the name in a # fluent manner, without changing the meaning, you may use that # translation at your discretion. self.set_program_name(_("NFO Viewer")) # TRANSLATORS: This is a special message that shouldn't be translated # literally. It is used in the about dialog to give credits to the # translators. Thus, you should translate it to your name and email # address. You can also include other translators who have contributed # to this translation; in that case, please write them on separate # lines seperated by newlines (\n). self.set_translator_credits(_("translator-credits")) self.set_version(nfoview.__version__) self.set_website("https://otsaloma.io/nfoview/") self.set_website_label(_("NFO Viewer Website")) self.set_wrap_license(True)
def __init__(self, parent): """Initialize an :class:`AboutDialog` instance.""" GObject.GObject.__init__(self) self.set_title(_("About NFO Viewer")) self.set_transient_for(parent) self.set_authors(("Osmo Salomaa <*****@*****.**>",)) self.set_comments(_("Viewer for NFO files")) self.set_copyright("Copyright © 2005–2016 Osmo Salomaa") self.set_license_type(Gtk.License.GPL_3_0) self.set_logo_icon_name("nfoview") # TRANSLATORS: The application name "NFO Viewer" has been intentionally # marked as translatable. If you manage to translate the name in a # fluent manner, without changing the meaning, you may use that # translation at your discretion. self.set_program_name(_("NFO Viewer")) # TRANSLATORS: This is a special message that shouldn't be translated # literally. It is used in the about dialog to give credits to the # translators. Thus, you should translate it to your name and email # address. You can also include other translators who have contributed # to this translation; in that case, please write them on separate # lines seperated by newlines (\n). self.set_translator_credits(_("translator-credits")) self.set_version(nfoview.__version__) self.set_website("http://otsaloma.io/nfoview/") self.set_website_label(_("NFO Viewer Website")) self.set_wrap_license(True)
def __init__(self, parent): """Initialize an :class:`ExportImageDialog` instance.""" GObject.GObject.__init__(self) self.set_title(_("Export Image")) self.set_transient_for(parent) self.set_action(Gtk.FileChooserAction.SAVE) self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL) self.add_button(_("_Save"), Gtk.ResponseType.OK) self.set_do_overwrite_confirmation(True) self.set_select_multiple(False) self.set_default_response(Gtk.ResponseType.OK)
def __init__(self, parent): GObject.GObject.__init__(self) self.set_title(_("Export Image")) self.set_transient_for(parent) self.set_action(Gtk.FileChooserAction.SAVE) if Base is Gtk.FileChooserNative: self.set_cancel_label(_("_Cancel")) self.set_accept_label(_("_Save")) if Base is Gtk.FileChooserDialog: self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL) self.add_button(_("_Save"), Gtk.ResponseType.OK) self.set_default_response(Gtk.ResponseType.OK) self.set_do_overwrite_confirmation(True) self.set_select_multiple(False)
class LightGreyOnDarkGray(ColorScheme): name = "light-grey-on-dark-grey" label = _("Light grey on dark grey") foreground = "#f2f2f2" background = "#666666" link = "#aaaaff" visited_link = "#ffaaff"
class DarkGreyOnLightGray(ColorScheme): name = "dark-grey-on-light-grey" label = _("Dark grey on light grey") foreground = "#666666" background = "#f2f2f2" link = "#5555ff" visited_link = "#ff55ff"
class Custom(ColorScheme): name = "custom" label = _("Custom") foreground = nfoview.conf.foreground_color background = nfoview.conf.background_color link = nfoview.conf.link_color visited_link = nfoview.conf.visited_link_color
class BlackOnWhite(ColorScheme): name = "black-on-white" label = _("Black on white") foreground = "#000000" background = "#ffffff" link = "#0000ff" visited_link = "#ff00ff"
class WhiteOnBlack(ColorScheme): name = "white-on-black" label = _("White on black") foreground = "#ffffff" background = "#000000" link = "#aaaaff" visited_link = "#ffaaff"
class GreyOnBlack(ColorScheme): name = "grey-on-black" label = _("Grey on black") foreground = "#aaaaaa" background = "#000000" link = "#aaaaff" visited_link = "#ffaaff"
class WhiteOnBlack(ColorScheme): """Color scheme with white text on black background.""" name = "white-on-black" label = _("White on black") foreground = "#ffffff" background = "#000000" link = "#aaaaff" visited_link = "#ffaaff"
class BlackOnWhite(ColorScheme): """Color scheme with black text on white background.""" name = "black-on-white" label = _("Black on white") foreground = "#000000" background = "#ffffff" link = "#0000ff" visited_link = "#ff00ff"
class Custom(ColorScheme): """Color scheme with custom, user-chosen colors.""" name = "custom" label = _("Custom") foreground = nfoview.conf.foreground_color background = nfoview.conf.background_color link = nfoview.conf.link_color visited_link = nfoview.conf.visited_link_color
class GreyOnBlack(ColorScheme): """Color scheme with grey text on black background.""" name = "grey-on-black" label = _("Grey on black") foreground = "#aaaaaa" background = "#000000" link = "#aaaaff" visited_link = "#ffaaff"
def __init__(self, parent): """Initialize an :class:`OpenDialog` instance.""" GObject.GObject.__init__(self) self.set_title(_("Open")) self.set_transient_for(parent) self.set_action(Gtk.FileChooserAction.OPEN) self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL) self.add_button(_("_Open"), Gtk.ResponseType.OK) self.set_select_multiple(True) self.set_default_response(Gtk.ResponseType.OK) file_filter = Gtk.FileFilter() file_filter.set_name(_("All files")) file_filter.add_pattern("*") self.add_filter(file_filter) file_filter = Gtk.FileFilter() file_filter.set_name(_("NFO files (*.nfo)")) file_filter.add_pattern("*.[Nn][Ff][Oo]") self.add_filter(file_filter) self.set_filter(file_filter)
class Default(ColorScheme): # https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/theme/Adwaita/_colors-public.scss # https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/theme/Adwaita/gtk-contained.css name = "default" label = _("System theme") foreground = nfoview.util.lookup_color("theme_text_color", "#000000") background = nfoview.util.lookup_color("theme_base_color", "#ffffff") link = "#2a76c6" visited_link = "#215d9c"
class Default(ColorScheme): """Color scheme with system default colors.""" # http://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita/_colors-public.scss # http://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita/gtk-contained.css name = "default" label = _("System theme") foreground = nfoview.util.lookup_color("theme_text_color", "#000000") background = nfoview.util.lookup_color("theme_base_color", "#ffffff") link = "#2a76c6" visited_link = "#215d9c"
def _init_titlebar(self): header = Gtk.HeaderBar() header.set_title(_("NFO Viewer")) header.set_show_close_button(True) menu_button = Gtk.MenuButton() menu_button.set_direction(Gtk.ArrowType.NONE) # Popover doesn't show keyboard shortcuts. menu_button.set_use_popover(False) path = os.path.join(nfoview.DATA_DIR, "menu.ui") builder = Gtk.Builder.new_from_file(path) menu = builder.get_object("menu") menu_button.set_menu_model(menu) header.pack_start(menu_button) header.show_all() self.set_titlebar(header)
def __init__(self, parent): GObject.GObject.__init__(self) self.set_title(_("Open")) self.set_transient_for(parent) self.set_action(Gtk.FileChooserAction.OPEN) if Base is Gtk.FileChooserNative: self.set_cancel_label(_("_Cancel")) self.set_accept_label(_("_Open")) if Base is Gtk.FileChooserDialog: self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL) self.add_button(_("_Open"), Gtk.ResponseType.OK) self.set_default_response(Gtk.ResponseType.OK) self.set_select_multiple(True) file_filter = Gtk.FileFilter() file_filter.set_name(_("All files")) file_filter.add_pattern("*") self.add_filter(file_filter) file_filter = Gtk.FileFilter() file_filter.set_name(_("NFO files (*.nfo)")) file_filter.add_pattern("*.[Nn][Ff][Oo]") self.add_filter(file_filter) self.set_filter(file_filter)
def __init__(self, parent): """Initialize an :class:`AboutDialog` instance.""" GObject.GObject.__init__(self) self.set_title(_("About NFO Viewer")) self.set_transient_for(parent) self.set_authors(("Osmo Salomaa <*****@*****.**>", )) self.set_comments(_("Viewer for NFO files")) self.set_copyright("Copyright © 2005–2017 Osmo Salomaa") self.set_license_type(Gtk.License.GPL_3_0) self.set_logo_icon_name("nfoview") # TRANSLATORS: The application name "NFO Viewer" has been intentionally # marked as translatable. If you manage to translate the name in a # fluent manner, without changing the meaning, you may use that # translation at your discretion. self.set_program_name(_("NFO Viewer")) # TRANSLATORS: This is a special message that shouldn't be translated # literally. It is used in the about dialog to give credits to the # translators. Thus, you should translate it to your name and email # address. You can also include other translators who have contributed # to this translation; in that case, please write them on separate # lines seperated by newlines (\n). self.set_translator_credits(_("translator-credits")) self.set_version(nfoview.__version__) self.set_website("https://otsaloma.io/nfoview/") self.set_website_label(_("NFO Viewer Website")) self.set_wrap_license(True) with nfoview.util.silent(Exception, tb=True): # Add donate button to the bottom of the dialog. # This can fail if the dialog structure changes. box = self.get_content_area() button = Gtk.LinkButton(label=_("Donate")) button.set_uri("https://www.paypal.me/otsaloma") button.show() box.pack_start(button, expand=False, fill=False, padding=0) header = self.get_header_bar() if header is not None: switcher = header.get_children()[0] switcher.get_children()[0].grab_focus()
def _translate_labels(): for scheme in list(map(globals().get, __all__)): if not hasattr(scheme, "untranslated_label"): scheme.untranslated_label = scheme.label scheme.label = _(scheme.untranslated_label)
def _translate_labels(): """Translate all color scheme labels.""" for scheme in list(map(globals().get, __all__)): if not hasattr(scheme, "untranslated_label"): scheme.untranslated_label = scheme.label scheme.label = _(scheme.untranslated_label)