Commit 6ec19271 authored by Arturo Hernandez's avatar Arturo Hernandez

working traymenu on deepin DM

parent bbe95c67
...@@ -14,6 +14,7 @@ sudo apt install pcscd pcsc-tools python3-pip python3-pyscard ...@@ -14,6 +14,7 @@ sudo apt install pcscd pcsc-tools python3-pip python3-pyscard
# pip3 install pyscard #instalado con apt # pip3 install pyscard #instalado con apt
pip3 install tornado pip3 install tornado
pip3 install pystray pip3 install pystray
sudo apt install python3-wxgtk4*
``` ```
......
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
if __name__ == '__main__':
print("hello")
...@@ -80,7 +80,7 @@ class MainHandler(tornado.web.RequestHandler): ...@@ -80,7 +80,7 @@ class MainHandler(tornado.web.RequestHandler):
LOGGER.debug(self.request) LOGGER.debug(self.request)
self.write("Hello, world") self.write("Hello, world")
class ReadHandler(tornado.web.RequestHandler): class ReadCardHandler(tornado.web.RequestHandler):
def set_default_headers(self): def set_default_headers(self):
self.set_header("Access-Control-Allow-Origin", "*") self.set_header("Access-Control-Allow-Origin", "*")
self.set_header('Access-Control-Allow-Methods', 'GET, OPTIONS') self.set_header('Access-Control-Allow-Methods', 'GET, OPTIONS')
...@@ -139,7 +139,7 @@ def make_app(): ...@@ -139,7 +139,7 @@ def make_app():
return tornado.web.Application([ return tornado.web.Application([
(r"/(index.*)?", IndexHandler), (r"/(index.*)?", IndexHandler),
(r"/api/?", TestHandler), (r"/api/?", TestHandler),
(r"/api/read-card/?", ReadHandler), (r"/api/read-card/?", ReadCardHandler),
(r"/api/write-card/?", MainHandler), (r"/api/write-card/?", MainHandler),
(r"/mst_cert.crt()",tornado.web.StaticFileHandler, {"path": config.MST_CERT}), (r"/mst_cert.crt()",tornado.web.StaticFileHandler, {"path": config.MST_CERT}),
(r"/(.*)",tornado.web.StaticFileHandler, {"path": "src/www"},), #path fixed to top (r"/(.*)",tornado.web.StaticFileHandler, {"path": "src/www"},), #path fixed to top
......
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
if __name__ == '__main__':
print("hello")
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import subprocess
import webbrowser
import wx import wx
import wx.adv import wx.adv
...@@ -12,6 +14,8 @@ os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ...@@ -12,6 +14,8 @@ os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
TRAY_TOOLTIP = 'AGETIC MST' TRAY_TOOLTIP = 'AGETIC MST'
TRAY_ICON = 'src/www/images.png' TRAY_ICON = 'src/www/images.png'
proc = None
def create_menu_item(menu, label, func): def create_menu_item(menu, label, func):
item = wx.MenuItem(menu, -1, label) item = wx.MenuItem(menu, -1, label)
menu.Bind(wx.EVT_MENU, func, id=item.GetId()) menu.Bind(wx.EVT_MENU, func, id=item.GetId())
...@@ -28,9 +32,9 @@ class TaskBarIcon(wx.adv.TaskBarIcon): ...@@ -28,9 +32,9 @@ class TaskBarIcon(wx.adv.TaskBarIcon):
def CreatePopupMenu(self): def CreatePopupMenu(self):
menu = wx.Menu() menu = wx.Menu()
create_menu_item(menu, 'Site', self.on_hello) create_menu_item(menu, 'Probar microservicio', self.on_hello)
menu.AppendSeparator() menu.AppendSeparator()
create_menu_item(menu, 'Exit', self.on_exit) create_menu_item(menu, 'Salir', self.on_exit)
return menu return menu
def set_icon(self, path): def set_icon(self, path):
...@@ -38,12 +42,16 @@ class TaskBarIcon(wx.adv.TaskBarIcon): ...@@ -38,12 +42,16 @@ class TaskBarIcon(wx.adv.TaskBarIcon):
self.SetIcon(icon, TRAY_TOOLTIP) self.SetIcon(icon, TRAY_TOOLTIP)
def on_left_down(self, event): def on_left_down(self, event):
print ('Tray icon was left-clicked.') print("ShowBaloon")
self.ShowBalloon(TRAY_TOOLTIP,"microservicio de tarjetas RFID", 5000)
def on_hello(self, event): def on_hello(self, event):
print ('Hello, world!') print ('Abriendo pagina de prueba')
webbrowser.open('https://127.0.0.1:8000/', new=2, autoraise=True)
def on_exit(self, event): def on_exit(self, event):
global proc
proc.terminate()
wx.CallAfter(self.Destroy) wx.CallAfter(self.Destroy)
self.frame.Close() self.frame.Close()
...@@ -55,7 +63,15 @@ class App(wx.App): ...@@ -55,7 +63,15 @@ class App(wx.App):
return True return True
def main(): def main():
global proc
app = App(False) app = App(False)
bitmap = wx.Bitmap(TRAY_ICON, wx.BITMAP_TYPE_PNG)
splash = wx.adv.SplashScreen(bitmap, wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT,
2000, None, -1, wx.DefaultPosition, wx.DefaultSize,
wx.BORDER_SIMPLE | wx.STAY_ON_TOP)
wx.Yield()
proc = subprocess.Popen(["python3", "src/main.py"])
app.MainLoop() app.MainLoop()
......
src/www/favicon.ico

163 KB | W: | H:

src/www/favicon.ico

1.12 KB | W: | H:

src/www/favicon.ico
src/www/favicon.ico
src/www/favicon.ico
src/www/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
src/www/images.png

4.9 KB | W: | H:

src/www/images.png

50.7 KB | W: | H:

src/www/images.png
src/www/images.png
src/www/images.png
src/www/images.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment