Skip to content

Commit 5d00de6

Browse files
committed
Fixes Issue #86: Minor UI Improvements
1 parent 75dadd9 commit 5d00de6

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

SWParser/gui/gui.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import SWProxy
55
import threading
66
import logging
7+
import time
78

89
logger = logging.getLogger("SWProxy")
910

@@ -51,6 +52,10 @@ def openPCAP(self):
5152
def log(self, str):
5253
self.ui.logWindow.addItem(str)
5354

55+
# After a short delay, scroll to the bottom of the window.
56+
# Cannot scroll immediately due to race condition with UI update
57+
threading.Timer(0.1, self.ui.logWindow.scrollToBottom).start()
58+
5459
def startStopProxy(self):
5560
self.ui.proxyPort.setReadOnly(True)
5661
if self.proxy:

SWProxy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def parse_pcap(filename):
233233

234234
# Set up logger
235235
level = "DEBUG" if options.debug else "INFO"
236-
logging.basicConfig(level=level, filename="proxy.log", format='%(asctime)s: %(name)s - %(levelname)s - %(message)s')
236+
logging.basicConfig(level=level, filename="proxy.log", format="%(asctime)s: %(name)s - %(levelname)s - %(message)s")
237237
logger.setLevel(logging.INFO)
238238

239239
print get_usage_text()
@@ -264,6 +264,8 @@ def parse_pcap(filename):
264264
app_icon.addFile(icons_path + '256x256.png', QSize(256,256))
265265
app.setWindowIcon(app_icon)
266266
win = gui.MainWindow(get_external_ip(), options.port)
267-
logger.addHandler(gui.GuiLogHandler(win))
267+
guiLogHandler = gui.GuiLogHandler(win)
268+
guiLogHandler.setFormatter(logging.Formatter(fmt="%(asctime)s %(message)s", datefmt="%X"))
269+
logger.addHandler(guiLogHandler)
268270
win.show()
269271
sys.exit(app.exec_())

plugins/DemoPlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
class DemoPlugin(SWPlugin.SWPlugin):
77
def process_request(self, req_json, resp_json):
8-
logger.info("Found Summoners War API request : %s" % req_json['command'])
8+
logger.info("Found Summoners War API request (wizard_id: %(wizard_id)s) : %(command)s " % req_json)

0 commit comments

Comments
 (0)