Merge pull request #318 from rbreaves/dev

Overlay warning added for setup, 2 default editors added for KDE
This commit is contained in:
Ben Reaves
2020-11-12 14:52:09 -06:00
committed by GitHub
2 changed files with 35 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ gi.require_version('Gtk', '3.0')
gi.require_version('Vte', '2.91') gi.require_version('Vte', '2.91')
from gi.repository import Gtk,Gdk,GdkPixbuf from gi.repository import Gtk,Gdk,GdkPixbuf
from gi.repository import Vte,GLib from gi.repository import Vte,GLib
from shutil import which
from subprocess import Popen,PIPE,CalledProcessError from subprocess import Popen,PIPE,CalledProcessError
from distutils.util import strtobool from distutils.util import strtobool
@@ -918,10 +919,14 @@ class MyWindow(Gtk.Window):
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which('kate') is not None:
Popen(['kate',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which('kwrite') is not None:
Popen(['kwrite',os.environ['HOME']+'/.config/kinto/kinto.py'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
Popen(['notify-send','Kinto: Error could not open config file!']) Popen(['notify-send','Kinto: Error could not open config file!'])
@@ -930,10 +935,14 @@ class MyWindow(Gtk.Window):
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service']) Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit','/lib/systemd/system/xkeysnail.service']) Popen(['gedit','/lib/systemd/system/xkeysnail.service'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad','/lib/systemd/system/xkeysnail.service']) Popen(['mousepad','/lib/systemd/system/xkeysnail.service'])
elif which('kate') is not None:
Popen(['kate','/lib/systemd/system/xkeysnail.service'])
elif which('kwrite') is not None:
Popen(['kwrite','/lib/systemd/system/xkeysnail.service'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
Popen(['notify-send','Kinto: Error could not open config file!']) Popen(['notify-send','Kinto: Error could not open config file!'])
@@ -941,12 +950,16 @@ class MyWindow(Gtk.Window):
def setSysKB(self,button): def setSysKB(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['xfce4-keyboard-settings']) Popen(['xfce4-keyboard-settings'])
elif self.ostype == "KDE":
self.queryConfig('systemsettings >/dev/null 2>&1 || systemsettings5 >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','keyboard']) Popen(['gnome-control-center','keyboard'])
def setRegion(self,button): def setRegion(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['gnome-language-selector']) Popen(['gnome-language-selector'])
elif self.ostype == "KDE":
self.queryConfig('kcmshell4 kcm_translations >/dev/null 2>&1 || kcmshell5 kcm_translations >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','region']) Popen(['gnome-control-center','region'])
@@ -1221,7 +1234,8 @@ class SecondPage(Gtk.Box):
scroller.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS) scroller.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
label_start = Gtk.Label() label_start = Gtk.Label()
label_start.set_markup('<b>Identifying your Keyboard...</b>\n\nPress the <b>2nd</b> key <b>Left</b> of the spacebar.')
label_start.set_markup('<b>Identifying your Keyboard...</b>\n\nPress the <b>2nd</b> key <b>Left</b> of the spacebar.\n\n<sub>If stuck here then unset Overlay (Super) key on your DE.</sub>')
label_start.set_alignment(0,0) label_start.set_alignment(0,0)
label_start.set_line_wrap(True) label_start.set_line_wrap(True)
vbox.add(label_start) vbox.add(label_start)

View File

@@ -620,10 +620,14 @@ class Indicator():
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which('kate') is not None:
Popen(['kate',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which('kwrite') is not None:
Popen(['kwrite',os.environ['HOME']+'/.config/kinto/kinto.py'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
Popen(['notify-send','Kinto: Error could not open config file!']) Popen(['notify-send','Kinto: Error could not open config file!'])
@@ -632,10 +636,14 @@ class Indicator():
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service']) Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit','/lib/systemd/system/xkeysnail.service']) Popen(['gedit','/lib/systemd/system/xkeysnail.service'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad','/lib/systemd/system/xkeysnail.service']) Popen(['mousepad','/lib/systemd/system/xkeysnail.service'])
elif which('kate') is not None:
Popen(['kate','/lib/systemd/system/xkeysnail.service'])
elif which('kwrite') is not None:
Popen(['kwrite','/lib/systemd/system/xkeysnail.service'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
Popen(['notify-send','Kinto: Error could not open config file!']) Popen(['notify-send','Kinto: Error could not open config file!'])
@@ -690,12 +698,16 @@ class Indicator():
def setSysKB(self,button): def setSysKB(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['xfce4-keyboard-settings']) Popen(['xfce4-keyboard-settings'])
elif self.ostype == "KDE":
self.queryConfig('systemsettings >/dev/null 2>&1 || systemsettings5 >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','keyboard']) Popen(['gnome-control-center','keyboard'])
def setRegion(self,button): def setRegion(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['gnome-language-selector']) Popen(['gnome-language-selector'])
elif self.ostype == "KDE":
self.queryConfig('kcmshell4 kcm_translations >/dev/null 2>&1 || kcmshell5 kcm_translations >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','region']) Popen(['gnome-control-center','region'])