From 90129d4161800b5acb41b2e2e55fcd59e1068659 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 2 Oct 2016 23:24:50 +0200 Subject: [PATCH] fix application detection, remove debugging print --- config/keyboard/test.conf | 8 ++++---- config/settings/settings.conf | 6 +++--- .../commands/commands/bookmark_1.py | 2 +- .../commands/commands/bookmark_10.py | 2 +- .../commands/commands/bookmark_2.py | 2 +- .../commands/commands/bookmark_3.py | 2 +- .../commands/commands/bookmark_4.py | 2 +- .../commands/commands/bookmark_5.py | 2 +- .../commands/commands/bookmark_6.py | 2 +- .../commands/commands/bookmark_7.py | 2 +- .../commands/commands/bookmark_8.py | 2 +- .../commands/commands/bookmark_9.py | 2 +- .../commands/commands/clear_bookmark_1.py | 2 +- src/fenrir-package/core/screenManager.py | 2 +- src/fenrir-package/screenDriver/linux.py | 15 ++++++++------- 15 files changed, 27 insertions(+), 26 deletions(-) diff --git a/config/keyboard/test.conf b/config/keyboard/test.conf index d3d32945..f2c6f50d 100644 --- a/config/keyboard/test.conf +++ b/config/keyboard/test.conf @@ -26,10 +26,10 @@ KEY_FENRIR,KEY_KPDOT=exit_review #KEY_FENRIR,KEY_KP5=curr_screen KEY_FENRIR,KEY_KP8=curr_screen_before_cursor KEY_FENRIR,KEY_KP2=curr_screen_after_cursor -KEY_FENRIR,KEY_1=set_window_application -KEY_FENRIR,KEY_3=clear_window_application -#KEY_FENRIR,KEY_3=clear_bookmark_1 -#KEY_FENRIR,KEY_1=set_bookmark_1 +#KEY_FENRIR,KEY_1=set_window_application +#KEY_FENRIR,KEY_3=clear_window_application +KEY_FENRIR,KEY_3=clear_bookmark_1 +KEY_FENRIR,KEY_1=set_bookmark_1 KEY_FENRIR,KEY_2=bookmark_1 KEY_KPPLUS=last_incoming KEY_FENRIR,KEY_F2=toggle_braille diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 5934063c..ce851095 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -57,7 +57,7 @@ module=espeak voice= # Select the language you want fenrir to use. -language=english-us +language=de # Read new text as it happens? autoReadIncoming=True @@ -82,7 +82,7 @@ device=AUTO grabDevices=True ignoreShortcuts=False # the current shortcut layout located in /etc/fenrir/keyboard -keyboardLayout=desktop +keyboardLayout=test # echo chars while typing. charEcho=False # echo deleted chars @@ -95,7 +95,7 @@ interruptOnKeyPress=False doubleTapDelay=0.2 [general] -debugLevel=3 +debugLevel=0 punctuationLevel=Some numberOfClipboards=10 # define the current fenrir key diff --git a/src/fenrir-package/commands/commands/bookmark_1.py b/src/fenrir-package/commands/commands/bookmark_1.py index af89911d..d7426c43 100644 --- a/src/fenrir-package/commands/commands/bookmark_1.py +++ b/src/fenrir-package/commands/commands/bookmark_1.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_10.py b/src/fenrir-package/commands/commands/bookmark_10.py index 9df8c53a..a975772b 100644 --- a/src/fenrir-package/commands/commands/bookmark_10.py +++ b/src/fenrir-package/commands/commands/bookmark_10.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_2.py b/src/fenrir-package/commands/commands/bookmark_2.py index 13bf67cd..5eb9a660 100644 --- a/src/fenrir-package/commands/commands/bookmark_2.py +++ b/src/fenrir-package/commands/commands/bookmark_2.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_3.py b/src/fenrir-package/commands/commands/bookmark_3.py index 72a9e69f..95c521d7 100644 --- a/src/fenrir-package/commands/commands/bookmark_3.py +++ b/src/fenrir-package/commands/commands/bookmark_3.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_4.py b/src/fenrir-package/commands/commands/bookmark_4.py index dd7c79e9..7386f998 100644 --- a/src/fenrir-package/commands/commands/bookmark_4.py +++ b/src/fenrir-package/commands/commands/bookmark_4.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_5.py b/src/fenrir-package/commands/commands/bookmark_5.py index 7fb1a8b4..9250b058 100644 --- a/src/fenrir-package/commands/commands/bookmark_5.py +++ b/src/fenrir-package/commands/commands/bookmark_5.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_6.py b/src/fenrir-package/commands/commands/bookmark_6.py index 2faa84be..0749587e 100644 --- a/src/fenrir-package/commands/commands/bookmark_6.py +++ b/src/fenrir-package/commands/commands/bookmark_6.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_7.py b/src/fenrir-package/commands/commands/bookmark_7.py index cb7880ff..e680dbdf 100644 --- a/src/fenrir-package/commands/commands/bookmark_7.py +++ b/src/fenrir-package/commands/commands/bookmark_7.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_8.py b/src/fenrir-package/commands/commands/bookmark_8.py index 1439dea6..d540c758 100644 --- a/src/fenrir-package/commands/commands/bookmark_8.py +++ b/src/fenrir-package/commands/commands/bookmark_8.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/bookmark_9.py b/src/fenrir-package/commands/commands/bookmark_9.py index a494a7a4..a6f53387 100644 --- a/src/fenrir-package/commands/commands/bookmark_9.py +++ b/src/fenrir-package/commands/commands/bookmark_9.py @@ -29,7 +29,7 @@ class command(): if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) return - print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']) + # set marks marked = '' startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() diff --git a/src/fenrir-package/commands/commands/clear_bookmark_1.py b/src/fenrir-package/commands/commands/clear_bookmark_1.py index deb89565..686b7ff0 100644 --- a/src/fenrir-package/commands/commands/clear_bookmark_1.py +++ b/src/fenrir-package/commands/commands/clear_bookmark_1.py @@ -18,7 +18,7 @@ class command(): def run(self): currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - + del self.env['commandBuffer']['bookMarks'][self.ID][currApp] self.env['runtime']['outputManager'].presentText('Bookmark ' + self.ID + " removed for application " + currApp, interrupt=True) diff --git a/src/fenrir-package/core/screenManager.py b/src/fenrir-package/core/screenManager.py index b800f2df..96559e1a 100644 --- a/src/fenrir-package/core/screenManager.py +++ b/src/fenrir-package/core/screenManager.py @@ -25,7 +25,7 @@ class screenManager(): self.env['runtime']['screenDriver'].getCurrScreen() if not self.isSuspendingScreen(): if trigger == 'onUpdate': - self.env['runtime']['applicationManager'].getCurrentApplication() + self.env['runtime']['screenDriver'].getCurrApplication() self.env['runtime']['screenDriver'].update(trigger) self.env['screenData']['lastScreenUpdate'] = time.time() diff --git a/src/fenrir-package/screenDriver/linux.py b/src/fenrir-package/screenDriver/linux.py index e46cf3f8..fcb35af7 100644 --- a/src/fenrir-package/screenDriver/linux.py +++ b/src/fenrir-package/screenDriver/linux.py @@ -34,8 +34,8 @@ class driver(): currScreen = self.env['screenData']['newTTY'] apps = subprocess.Popen('ps -t tty' + currScreen + ' -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') except Exception as e: - return '' - + print(e) + return try: for i in apps: i = i.upper() @@ -48,13 +48,14 @@ class driver(): not "SH" == i[0] and \ not "PS" == i[0]: if "TTY"+currScreen in i[1]: - if self.env['runtime']['applicationManager'].isApplicationChange(): + if self.env['screenData']['newApplication'] != i[0]: self.env['screenData']['oldApplication'] = self.env['screenData']['newApplication'] self.env['screenData']['newApplication'] = i[0] - return - except: - return '' - return '' + return + except Exception as e: + print(e) + return + return def getIgnoreScreens(self): xlist = []