Skip to content

Commit d211f3d

Browse files
committed
webui works in non-quiet mode if invoked directly.
1 parent d227c8e commit d211f3d

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

inputscope/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
WebAutoReload = False
197197

198198
"""Whether web server is quiet or echoes access log."""
199-
WebQuiet = True
199+
WebQuiet = False
200200

201201
"""Whether running as a pyinstaller executable."""
202202
Frozen = getattr(sys, "frozen", False)

inputscope/listener.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"""
33
Mouse and keyboard listener, logs events to database.
44
5+
--quiet prints out nothing
6+
57
@author Erki Suurjaak
68
@created 06.04.2015
79
@modified 07.05.2015

inputscope/main.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def run(self):
8787
os.path.join(conf.ApplicationPath, x[0])] + list(x[1:])
8888
self.listener = subprocess.Popen(args("listener.py", "--quiet"),
8989
stdin=subprocess.PIPE)
90-
self.webui = subprocess.Popen(args("webui.py"))
90+
self.webui = subprocess.Popen(args("webui.py", "--quiet"))
9191
self.listenerqueue = QueueLine(self.listener.stdin)
9292

9393
if conf.MouseEnabled: self.listenerqueue.put("mouse_start")
@@ -129,17 +129,14 @@ def OnInit(self):
129129

130130
def OnOpenMenu(self, event):
131131
"""Creates and opens a popup menu for the tray icon."""
132-
menu = wx.Menu()
133-
item_ui = wx.MenuItem(menu, -1, "&Open statistics")
134-
item_startup = wx.MenuItem(menu, -1, "&Start with Windows",
135-
kind=wx.ITEM_CHECK) if self.startupservice.can_start() else None
136-
item_mouse = wx.MenuItem(menu, -1, "Stop &mouse logging",
137-
kind=wx.ITEM_CHECK)
138-
item_keyboard = wx.MenuItem(menu, -1, "Stop &keyboard logging",
139-
kind=wx.ITEM_CHECK)
140-
item_console = wx.MenuItem(menu, -1, "Show Python &console",
141-
kind=wx.ITEM_CHECK)
142-
item_exit = wx.MenuItem(menu, -1, "E&xit %s" % conf.Title)
132+
menu, makeitem = wx.Menu(), lambda x, **k: wx.MenuItem(menu, -1, x, **k)
133+
item_ui = makeitem("&Open statistics")
134+
item_startup = makeitem("&Start with Windows", kind=wx.ITEM_CHECK) \
135+
if self.startupservice.can_start() else None
136+
item_mouse = makeitem("Stop &mouse logging", kind=wx.ITEM_CHECK)
137+
item_keyboard = makeitem("Stop &keyboard logging", kind=wx.ITEM_CHECK)
138+
item_console = makeitem("Show Python &console", kind=wx.ITEM_CHECK)
139+
item_exit = makeitem("E&xit %s" % conf.Title)
143140

144141
font = item_ui.Font
145142
font.SetWeight(wx.FONTWEIGHT_BOLD)
@@ -243,7 +240,7 @@ def create_shortcut(self, path, target="", workdir="", icon=""):
243240

244241

245242
def main():
246-
"""Entry point for stand-alone execution."""
243+
"""Program entry point."""
247244
conf.init(), db.init(conf.DbPath, conf.DbStatements)
248245

249246
if wx:

inputscope/webui.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"""
33
Web frontend interface, displays statistics from a database.
44
5+
--quiet prints out nothing
6+
57
@author Erki Suurjaak
68
@created 06.04.2015
79
@modified 06.05.2015
@@ -10,6 +12,7 @@
1012
import datetime
1113
import math
1214
import re
15+
import sys
1316
import bottle
1417
from bottle import hook, request, route
1518

@@ -230,7 +233,7 @@ def start():
230233

231234
def main():
232235
"""Entry point for stand-alone execution."""
233-
conf.WebQuiet = False
236+
conf.WebQuiet = "--quiet" in sys.argv
234237
start()
235238

236239

0 commit comments

Comments
 (0)