Skip to content

Commit

Permalink
Fixes Issue #86: Minor UI Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-griffin committed Nov 2, 2016
1 parent 75dadd9 commit 5d00de6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions SWParser/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import SWProxy
import threading
import logging
import time

logger = logging.getLogger("SWProxy")

Expand Down Expand Up @@ -51,6 +52,10 @@ def openPCAP(self):
def log(self, str):
self.ui.logWindow.addItem(str)

# After a short delay, scroll to the bottom of the window.
# Cannot scroll immediately due to race condition with UI update
threading.Timer(0.1, self.ui.logWindow.scrollToBottom).start()

def startStopProxy(self):
self.ui.proxyPort.setReadOnly(True)
if self.proxy:
Expand Down
6 changes: 4 additions & 2 deletions SWProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def parse_pcap(filename):

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

print get_usage_text()
Expand Down Expand Up @@ -264,6 +264,8 @@ def parse_pcap(filename):
app_icon.addFile(icons_path + '256x256.png', QSize(256,256))
app.setWindowIcon(app_icon)
win = gui.MainWindow(get_external_ip(), options.port)
logger.addHandler(gui.GuiLogHandler(win))
guiLogHandler = gui.GuiLogHandler(win)
guiLogHandler.setFormatter(logging.Formatter(fmt="%(asctime)s %(message)s", datefmt="%X"))
logger.addHandler(guiLogHandler)
win.show()
sys.exit(app.exec_())
2 changes: 1 addition & 1 deletion plugins/DemoPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

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

0 comments on commit 5d00de6

Please sign in to comment.