def __init__(self, config): QSystemTrayIcon.__init__(self) self.config = config self.setIcon(QIcon(QPixmap(os.path.join(get_main_dir(), 'Spider.web.logo.png')))) self.menu = QMenu(QString("WebScard Menu")) self.setContextMenu(self.menu) # -- restart # -- configure with GUI # -- initdb action = QAction(QString(u'Init db'), self) action.setToolTip(u'Initialize the database as configured') action.triggered.connect(self.on_initdb) self.menu.addAction(action) # -- Quit action = QAction(QString(u'Quit'), self) action.setToolTip(u'Quit everything') action.triggered.connect(self.on_quit) self.menu.addAction(action) self.setToolTip(QString(u'WebSCard: Smart card WSGI server')) self.webserverthread = WebServerThread(config) self.webserverthread.start() self.show()
import os from cherrypy import wsgiserver from paste.translogger import TransLogger from webscard.application import WebSCard from webscard.config import Config from webscard.utils import get_main_dir config = Config(os.path.join(get_main_dir(), 'webscard.cfg')) if config['logger'].get('web', False): app = TransLogger(WebSCard(config)) else: app = WebSCard(config) server = wsgiserver.CherryPyWSGIServer((config.gethost(), config.getport()), app) try: server.start() except KeyboardInterrupt: server.stop()
#!/usr/bin/env python import os from webscard.icon import qt from webscard.utils import main_is_frozen, get_main_dir if main_is_frozen(): import sys sys.stderr = open('webscard_err.log', 'w') sys.stdout = open('webscard_out.log', 'w') if __name__ == "__main__": qt.make_app(os.path.join(get_main_dir(),'webscard.cfg'))