summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-12-13 17:55:37 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-12-13 17:56:03 +0100
commita4b92d4e3fda5209c03389aff6cf35c537b88ab9 (patch)
tree2b6a54293ae3d1ce8c63ec0d77696f111ffedcce
downloadtips-og-hjelp-a4b92d4e3fda5209c03389aff6cf35c537b88ab9.tar.gz
tips-og-hjelp-a4b92d4e3fda5209c03389aff6cf35c537b88ab9.tar.bz2
tips-og-hjelp-a4b92d4e3fda5209c03389aff6cf35c537b88ab9.zip
Port Linnea Skogtvedt's kun-tips script to PyQt5 / Python3 and add i18n support.
-rwxr-xr-xbin/kun-tips111
-rw-r--r--tips.cfg157
2 files changed, 268 insertions, 0 deletions
diff --git a/bin/kun-tips b/bin/kun-tips
new file mode 100755
index 0000000..a279856
--- /dev/null
+++ b/bin/kun-tips
@@ -0,0 +1,111 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2009-2011 Linnea Skogtvedt <linnea@linuxavdelingen.no>
+# Copyright 2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# Example /etc/tips.cfg:
+# [tips]
+# title = Tips
+# user message = Click <a href="/usr/share/applications/putty.desktop">here</a> to launch the PuTTY application.
+# open urls with = kfmclient exec
+
+
+import sys
+import locale
+import configparser
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import QApplication, QDialog, QLabel, QVBoxLayout
+
+class ConfigException(BaseException):
+ pass
+
+class Form(QDialog):
+
+ clicked = pyqtSignal()
+
+ def __init__(self):
+ super().__init__()
+
+ lang, encoding = locale.getlocale()
+ lang, region = lang.split("_")
+
+ cfg = configparser.RawConfigParser()
+ if sys.argv[1:]:
+ cfgFile = sys.argv[1]
+ else:
+ cfgFile = '/etc/tips.cfg'
+ cfg.readfp(open(cfgFile, 'r'))
+
+ # check if the tips.cfg file has valid sections...
+ section = 'tips'
+ if not cfg.has_section(section):
+ section = 'rapporter-fail'
+ if not cfg.has_section(section):
+ raise ConfigException
+
+ title_options = [
+ 'title[{lang}_{region}]'.format(lang=lang, region=region),
+ 'title[{lang}]'.format(lang=lang),
+ 'title',
+ ]
+ for option in title_options:
+ if cfg.has_option(section, option):
+ title = cfg.get(section, option)
+ break
+ else:
+ raise ConfigException
+
+ try:
+ urlOpener = cfg.get(section, 'open urls with')
+ except configparser.NoOptionError:
+ urlOpener = "xdg-open"
+
+ msg_options = [
+ 'msg[{lang}_{region}]'.format(lang=lang, region=region),
+ 'msg[{lang}]'.format(lang=lang),
+ 'msg',
+ ]
+ for option in msg_options:
+ if cfg.has_option(section, option):
+ msg = cfg.get(section, option)
+ break
+ else:
+ raise ConfigException
+
+ def openLink(link):
+ import shlex
+ argv = shlex.split(urlOpener) + [link]
+ QProcess.startDetached(argv[0], argv[1:])
+
+ msgLabel = QLabel(msg)
+ msgLabel.setTextFormat(Qt.RichText)
+ msgLabel.linkActivated.connect(openLink)
+
+ layout = QVBoxLayout()
+ layout.addWidget(msgLabel)
+ self.setLayout(layout)
+ self.setWindowTitle(title)
+
+
+app = QApplication(sys.argv)
+form = Form()
+form.show()
+app.exec_()
diff --git a/tips.cfg b/tips.cfg
new file mode 100644
index 0000000..bf3dace
--- /dev/null
+++ b/tips.cfg
@@ -0,0 +1,157 @@
+[tips]
+open urls with = xdg-open
+title = Hints
+msg = You may have encoutered one of these common problems:
+
+ <ol>
+ <li><font size="5">
+ If your Firefox webbrowser shows the following message:
+ <b>Firefox is<br />already running, but is not responding ...</b>,
+ then click <a href="/usr/share/applications/fix-firefox.desktop">here</a><br />
+ and answer with "Yes".
+ You can also go directly to <br />System->Settings->Fix Firefox Startup.
+ You can also use another<br />web browser, for example
+ <a href="/usr/share/applications/chromium.desktop">Chromium</a>.
+ </li>
+
+ <li><font size="5">
+ Reset profile settings. If you have the problem that your
+ <b>desktop looks<br />strange</b>, you are missing some icons and menus, click
+ <a href="/usr/share/applications/desktop-reset.desktop">here</a> and
+ answer<br />with "Yes". You can also go directly to
+ System->Settings->Reset Desktop<br />Settings.
+ </li>
+
+ <li><font size="5">
+ If you have problems with <b>LibreOffice</b>, click
+ <a href="/usr/share/applications/libreoffice-reset.desktop">here</a>
+ and answer with "Yes". <br /> You can also go directly to
+ System->Settings->Reset LibreOffice Settings.
+ </li>
+
+ <li><font size="5">
+ If you have a reason for <b>changing your password</b>, then use<br />
+ System->Settings->Change Password, or click this link
+ <a href="/usr/share/applications/chguserpw.desktop">Change Password</a>.
+ </li>
+
+ <li><font size="5">
+ If you want to <b>add application shortcuts</b> to your desktop, then click
+ <br /> <a href="/usr/share/applications/xfce4-appfinder.desktop">Application Finder</a>
+ and drag shortcuts from there to your desktop.
+ </li>
+
+ <li><font size="5">
+ If you need to <b>make a screenshot for reporting an error message</b><br />
+ then press the PrintScreen key on your keyboard or click here to
+ start the <br />
+ <a href="/usr/share/applications/mate-screenshot.desktop">screenshot utility</a>.
+ </li>
+ </ol>
+
+
+### localized messages
+
+title[de_DE] = Hinweise
+msg[de_DE] = Eventuell ist eines der folgenden häufigen Probleme bei Ihnen aufgetreten:
+
+ <ol>
+ <li><font size="5">
+ Wenn der Firefox Webbrowser die folgende Meldung anzeigt: <b>Firefox is already running,<br />
+ but is not responding ...</b>, dann klicken Sie <a href="/usr/share/applications/fix-firefox.desktop">hier</a>
+ und antworten mit "Ja".<br />
+ Sie können das Programm auch direkt ausführen: System->Einstellungen->Firefox Startproblem beheben.<br />
+ Sie können auch einen anderen Webbrowser verwenden, z.Bsp. <a href="/usr/share/applications/chromium.desktop">Chromium</a>.
+ </li>
+
+ <li><font size="5">
+ Profileinstellungen zurücksetzen.
+ <b>Sollte Ihre Arbeitsoberfläche komisch aussehen</b>, <br />
+ fehlen Symbole und Menüs, dann klicken Sie
+ <a href="/usr/share/applications/desktop-reset.desktop">hier</a> und
+ antworten mit "Ja".<br /> Sie können das Programm auch direkt ausführen:
+ System->Einstellungen->Einstellungen der Arbeitsoberfläche<br />zurücksetzen.
+ </li>
+
+ <li><font size="5">
+ Sollten Sie Probleme mit <b>LibreOffice</b> haben, dann klicken Sie
+ <a href="/usr/share/applications/libreoffice-reset.desktop">hier</a>
+ und antworten mit "Ja". <br /> Sie können das Programm auch direkt ausführen:
+ System->Einstellungen->LibreOffice Einstellungen<br />zurücksetzen.
+ </li>
+
+ <li><font size="5">
+ Sollten Sie Gründe haben, Ihr <b>Kennwort ändern</b> zu müssen, dann verwenden Sie <br />
+ System->Einstellungen->Kennwort ändern, oder klicken Sie einfach diesen Link:
+ <a href="/usr/share/applications/chguserpw.desktop">Kennwort ändern</a>.
+ </li>
+
+ <li><font size="5">
+ Wenn Sie <b>eine Anwendungsverknüpfung auf der Arbeitsfläche erstellen</b> wollen, dann klicken Sie hier:
+ <br /> <a href="/usr/share/applications/xfce4-appfinder.desktop">Anwendungssuche</a>.
+ Aus der Anwendungssuche können Sie Verknüpfungen auf die Arbeitsfläche ziehen.
+ </li>
+
+ <li><font size="5">
+ Sollten Sie einmal <b>ein Bildschirmfoto für eine Fehlermeldung</b>erstellen müssen,<br />
+ dann drücken Sie die Drucken-Taste auf der Tastatur oder klicken Sie folgenden Link,<br />
+ um das <a href="/usr/share/applications/mate-screenshot.desktop">Bildschirmfoto Hilfsprogramm</a> zu starten.
+ </li>
+ </ol>
+
+title[nb_NO] = Tips
+msg[nb_NO] = Her er de vanligste feilene:
+
+ <ol>
+ <li><font size="5">
+
+ Hvis du har problem med at nettleseren <b>Firefox ikke vil starte, ..
+ is already running</b>, <br /> så klikk
+ <a href="/usr/share/applications/fix-firefox.desktop">her</a> og svar "Ja".
+ Du kan også gå rett til System->Innstillinger->Fiks Firefox. <br />
+ Du kan også bruke en annen nettleser, som f.eks
+ <a href="/usr/share/applications/chromium.desktop">Chromium</a>.
+
+ </li>
+ <li><font size="5">
+
+ Tilbakestill profil. Hvis du har problem med at <b>Skrivebordet ser
+ rart ut</b>, <br />du mangler kanskje ikoner og menyer, klikk
+ <a href="/usr/share/applications/desktop-reset.desktop">her</a> og
+ svar "Ja".<br /> Du kan også gå rett til
+ System->Innstillinger->Nullstill skrivebord.
+
+ </li>
+ <li><font size="5">
+
+ Hvis du har problemer med <b>LibreOffice</b>, klikk <a
+ href="/usr/share/applications/libreoffice-reset.desktop">her</a>
+ og svar "Ja". <br /> Du kan også gå rett til
+ System->Innstillinger->Nullstill LibreOffice innstillinger.
+
+ </li>
+ <li><font size="5">
+
+ Hvis du trenger å <b>bytte passord</b>, så bruk <br />
+ System->Innstillinger->Bytt Passord, eller trykk her på
+ <a href="/usr/local/share/applications/chguserpw.desktop">Bytt
+ Passord</a>.
+
+ </li>
+ <li><font size="5">
+
+ Hvis du vil <b>legge snarveier til program</b>, på Skrivebordet så
+ klikker du her på <br />
+ <a href="/usr/share/applications/xfce4-appfinder.desktop">Programvarekatalog</a>
+ og drar snarveien ut på Skrivebordet.
+
+ </li>
+ <li><font size="5">
+
+ Hvis du trenger å <b>ta et skjermbilde av en feilmelding</b>, <br />så
+ trykk på PrintScreen-knappen på tastaturet, eller klikk her for å
+ starte
+ <a href="/usr/share/applications/mate-screenshot.desktop">skjermbilde</a>.
+
+ </li>
+ </ol>