Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Issue #86: Minor UI Improvements #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)