Add files via upload
This commit is contained in:
parent
1b8011c332
commit
f40412c645
8 changed files with 115 additions and 49 deletions
|
@ -1,4 +1,3 @@
|
||||||
# try:
|
|
||||||
from pygwin.surface import surface
|
from pygwin.surface import surface
|
||||||
import pygwin.keyboard as keyboard
|
import pygwin.keyboard as keyboard
|
||||||
from pygwin.console import console
|
from pygwin.console import console
|
||||||
|
@ -7,29 +6,10 @@ import pygwin.mouse as mouse
|
||||||
from pygwin.rect import rect
|
from pygwin.rect import rect
|
||||||
import pygwin.image as image
|
import pygwin.image as image
|
||||||
import pygwin.mixer as mixer
|
import pygwin.mixer as mixer
|
||||||
|
from pygwin.tray import tray
|
||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
import pygwin.font as font
|
import pygwin.font as font
|
||||||
from pygwin._win import *
|
from pygwin._win import *
|
||||||
from pygwin._pg import pg
|
from pygwin._pg import pg
|
||||||
import pygwin.ui as ui
|
import pygwin.ui as ui
|
||||||
gamepad = _gp.gamepad(pg)
|
gamepad = _gp.gamepad(pg)
|
||||||
# except ModuleNotFoundError as e:
|
|
||||||
# import pip,os,sys
|
|
||||||
# if 'imofpgw' in sys.argv:
|
|
||||||
# os.system('cls' if os.name in ('nt', 'dos') else 'clear')
|
|
||||||
# raise e
|
|
||||||
# def install(package):
|
|
||||||
# if hasattr(pip,'main'):pip.main(['install',package])
|
|
||||||
# else:pip._internal.main(['install',package])
|
|
||||||
# os.system('cls' if os.name in ('nt', 'dos') else 'clear')
|
|
||||||
# modules = ['datetime',
|
|
||||||
# 'tempfile',
|
|
||||||
# 'pywin32',
|
|
||||||
# 'pickle',
|
|
||||||
# 'pygame',
|
|
||||||
# 'inputs',
|
|
||||||
# 'pydub',
|
|
||||||
# 'ctypes']
|
|
||||||
# for i in modules:
|
|
||||||
# install(i)
|
|
||||||
# os.execv(sys.executable, ['python']+sys.argv+['imofpgw'])
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from pygwin.surface import surface as _surface
|
from pygwin.surface import surface as _surface
|
||||||
from pygwin._tray import tray as _tray
|
from pygwin.tray import tray as _tray
|
||||||
from datetime import datetime as _dt
|
from datetime import datetime as _dt
|
||||||
from pygwin.image import save as _s
|
from pygwin.image import save as _s
|
||||||
from pygwin._pg import pg as _pg
|
from pygwin._pg import pg as _pg
|
||||||
|
@ -21,7 +21,7 @@ class win(_surface):
|
||||||
self._clock = _pg.time.Clock()
|
self._clock = _pg.time.Clock()
|
||||||
self._withfps = False
|
self._withfps = False
|
||||||
self._iconpath = iconpath
|
self._iconpath = iconpath
|
||||||
self.tray = _tray(_pg.display.get_caption(),self._iconpath)
|
self.tray = _tray(self.title,iconpath)
|
||||||
def update(self, fps=-1):
|
def update(self, fps=-1):
|
||||||
if fps != -1:
|
if fps != -1:
|
||||||
self._clock.tick(fps)
|
self._clock.tick(fps)
|
||||||
|
@ -108,6 +108,7 @@ def create(title=None, size=(0,0), icon=None, resizable=False, noframe=False):
|
||||||
_pg.display.set_caption(title)
|
_pg.display.set_caption(title)
|
||||||
if icon != None:
|
if icon != None:
|
||||||
_pg.display.set_icon(_pg.image.load(icon))
|
_pg.display.set_icon(_pg.image.load(icon))
|
||||||
|
return win(icon)
|
||||||
else:
|
else:
|
||||||
surf = _img.fromBytes(_icon.iconbytes)
|
surf = _img.fromBytes(_icon.iconbytes)
|
||||||
try:
|
try:
|
||||||
|
@ -115,7 +116,6 @@ def create(title=None, size=(0,0), icon=None, resizable=False, noframe=False):
|
||||||
except:
|
except:
|
||||||
orig = surf._orig
|
orig = surf._orig
|
||||||
_pg.display.set_icon(orig)
|
_pg.display.set_icon(orig)
|
||||||
return win(icon)
|
|
||||||
return win()
|
return win()
|
||||||
|
|
||||||
def ramLimit(memory_limit):
|
def ramLimit(memory_limit):
|
||||||
|
|
53
build/lib/pygwin/tray.py
Normal file
53
build/lib/pygwin/tray.py
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import threading
|
||||||
|
import wx
|
||||||
|
import wx.adv
|
||||||
|
from pygwin._pg import pg
|
||||||
|
|
||||||
|
class tray(wx.adv.TaskBarIcon):
|
||||||
|
def __init__(self, tooltip, iconpath):
|
||||||
|
class App(wx.App):
|
||||||
|
def OnInit(self):
|
||||||
|
self.frame = wx.Frame(None)
|
||||||
|
self.SetTopWindow(self.frame)
|
||||||
|
return True
|
||||||
|
self._app = App(False)
|
||||||
|
self.frame = self._app.frame
|
||||||
|
super().__init__()
|
||||||
|
self._tooltip = tooltip
|
||||||
|
self.setIcon(iconpath)
|
||||||
|
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN,
|
||||||
|
lambda x:self.onLeftMouseButton())
|
||||||
|
self._menu = wx.Menu()
|
||||||
|
|
||||||
|
def CreatePopupMenu(self):
|
||||||
|
return self._menu
|
||||||
|
|
||||||
|
def setIcon(self, path):
|
||||||
|
self._bicon = wx.Icon(wx.Bitmap(path))
|
||||||
|
self.SetIcon(self._bicon, self._tooltip)
|
||||||
|
|
||||||
|
def setTooltip(self, tooltip):
|
||||||
|
self.SetIcon(self._bicon, tooltip)
|
||||||
|
self._tooltip = tooltip
|
||||||
|
|
||||||
|
def onLeftMouseButton(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def addSeparator(self):
|
||||||
|
self._menu.AppendSeparator()
|
||||||
|
|
||||||
|
def addCommand(self,text,func=lambda:None):
|
||||||
|
item = wx.MenuItem(self._menu,-1,text)
|
||||||
|
self._menu.Bind(wx.EVT_MENU,
|
||||||
|
lambda x:func(),
|
||||||
|
id=item.GetId())
|
||||||
|
self._menu.Append(item)
|
||||||
|
|
||||||
|
def start(self, thread=True):
|
||||||
|
if thread: threading.Thread(
|
||||||
|
target=self._app.MainLoop,
|
||||||
|
daemon=1).start()
|
||||||
|
else: self._app.MainLoop()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
wx.CallAfter(self._app.frame.Close)
|
BIN
dist/pygwin-0.1.0-py3.7.egg
vendored
BIN
dist/pygwin-0.1.0-py3.7.egg
vendored
Binary file not shown.
|
@ -2,7 +2,6 @@ setup.py
|
||||||
pygwin/__init__.py
|
pygwin/__init__.py
|
||||||
pygwin/_icon.py
|
pygwin/_icon.py
|
||||||
pygwin/_pg.py
|
pygwin/_pg.py
|
||||||
pygwin/_tray.py
|
|
||||||
pygwin/_win.py
|
pygwin/_win.py
|
||||||
pygwin/console.py
|
pygwin/console.py
|
||||||
pygwin/font.py
|
pygwin/font.py
|
||||||
|
@ -13,6 +12,7 @@ pygwin/mixer.py
|
||||||
pygwin/mouse.py
|
pygwin/mouse.py
|
||||||
pygwin/rect.py
|
pygwin/rect.py
|
||||||
pygwin/surface.py
|
pygwin/surface.py
|
||||||
|
pygwin/tray.py
|
||||||
pygwin/ui.py
|
pygwin/ui.py
|
||||||
pygwin.egg-info/PKG-INFO
|
pygwin.egg-info/PKG-INFO
|
||||||
pygwin.egg-info/SOURCES.txt
|
pygwin.egg-info/SOURCES.txt
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# try:
|
|
||||||
from pygwin.surface import surface
|
from pygwin.surface import surface
|
||||||
import pygwin.keyboard as keyboard
|
import pygwin.keyboard as keyboard
|
||||||
from pygwin.console import console
|
from pygwin.console import console
|
||||||
|
@ -7,29 +6,10 @@ import pygwin.mouse as mouse
|
||||||
from pygwin.rect import rect
|
from pygwin.rect import rect
|
||||||
import pygwin.image as image
|
import pygwin.image as image
|
||||||
import pygwin.mixer as mixer
|
import pygwin.mixer as mixer
|
||||||
|
from pygwin.tray import tray
|
||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
import pygwin.font as font
|
import pygwin.font as font
|
||||||
from pygwin._win import *
|
from pygwin._win import *
|
||||||
from pygwin._pg import pg
|
from pygwin._pg import pg
|
||||||
import pygwin.ui as ui
|
import pygwin.ui as ui
|
||||||
gamepad = _gp.gamepad(pg)
|
gamepad = _gp.gamepad(pg)
|
||||||
# except ModuleNotFoundError as e:
|
|
||||||
# import pip,os,sys
|
|
||||||
# if 'imofpgw' in sys.argv:
|
|
||||||
# os.system('cls' if os.name in ('nt', 'dos') else 'clear')
|
|
||||||
# raise e
|
|
||||||
# def install(package):
|
|
||||||
# if hasattr(pip,'main'):pip.main(['install',package])
|
|
||||||
# else:pip._internal.main(['install',package])
|
|
||||||
# os.system('cls' if os.name in ('nt', 'dos') else 'clear')
|
|
||||||
# modules = ['datetime',
|
|
||||||
# 'tempfile',
|
|
||||||
# 'pywin32',
|
|
||||||
# 'pickle',
|
|
||||||
# 'pygame',
|
|
||||||
# 'inputs',
|
|
||||||
# 'pydub',
|
|
||||||
# 'ctypes']
|
|
||||||
# for i in modules:
|
|
||||||
# install(i)
|
|
||||||
# os.execv(sys.executable, ['python']+sys.argv+['imofpgw'])
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from pygwin.surface import surface as _surface
|
from pygwin.surface import surface as _surface
|
||||||
from pygwin._tray import tray as _tray
|
from pygwin.tray import tray as _tray
|
||||||
from datetime import datetime as _dt
|
from datetime import datetime as _dt
|
||||||
from pygwin.image import save as _s
|
from pygwin.image import save as _s
|
||||||
from pygwin._pg import pg as _pg
|
from pygwin._pg import pg as _pg
|
||||||
|
@ -21,7 +21,7 @@ class win(_surface):
|
||||||
self._clock = _pg.time.Clock()
|
self._clock = _pg.time.Clock()
|
||||||
self._withfps = False
|
self._withfps = False
|
||||||
self._iconpath = iconpath
|
self._iconpath = iconpath
|
||||||
self.tray = _tray(_pg.display.get_caption(),self._iconpath)
|
self.tray = _tray(self.title,iconpath)
|
||||||
def update(self, fps=-1):
|
def update(self, fps=-1):
|
||||||
if fps != -1:
|
if fps != -1:
|
||||||
self._clock.tick(fps)
|
self._clock.tick(fps)
|
||||||
|
@ -108,6 +108,7 @@ def create(title=None, size=(0,0), icon=None, resizable=False, noframe=False):
|
||||||
_pg.display.set_caption(title)
|
_pg.display.set_caption(title)
|
||||||
if icon != None:
|
if icon != None:
|
||||||
_pg.display.set_icon(_pg.image.load(icon))
|
_pg.display.set_icon(_pg.image.load(icon))
|
||||||
|
return win(icon)
|
||||||
else:
|
else:
|
||||||
surf = _img.fromBytes(_icon.iconbytes)
|
surf = _img.fromBytes(_icon.iconbytes)
|
||||||
try:
|
try:
|
||||||
|
@ -115,7 +116,6 @@ def create(title=None, size=(0,0), icon=None, resizable=False, noframe=False):
|
||||||
except:
|
except:
|
||||||
orig = surf._orig
|
orig = surf._orig
|
||||||
_pg.display.set_icon(orig)
|
_pg.display.set_icon(orig)
|
||||||
return win(icon)
|
|
||||||
return win()
|
return win()
|
||||||
|
|
||||||
def ramLimit(memory_limit):
|
def ramLimit(memory_limit):
|
||||||
|
|
53
pygwin/tray.py
Normal file
53
pygwin/tray.py
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import threading
|
||||||
|
import wx
|
||||||
|
import wx.adv
|
||||||
|
from pygwin._pg import pg
|
||||||
|
|
||||||
|
class tray(wx.adv.TaskBarIcon):
|
||||||
|
def __init__(self, tooltip, iconpath):
|
||||||
|
class App(wx.App):
|
||||||
|
def OnInit(self):
|
||||||
|
self.frame = wx.Frame(None)
|
||||||
|
self.SetTopWindow(self.frame)
|
||||||
|
return True
|
||||||
|
self._app = App(False)
|
||||||
|
self.frame = self._app.frame
|
||||||
|
super().__init__()
|
||||||
|
self._tooltip = tooltip
|
||||||
|
self.setIcon(iconpath)
|
||||||
|
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN,
|
||||||
|
lambda x:self.onLeftMouseButton())
|
||||||
|
self._menu = wx.Menu()
|
||||||
|
|
||||||
|
def CreatePopupMenu(self):
|
||||||
|
return self._menu
|
||||||
|
|
||||||
|
def setIcon(self, path):
|
||||||
|
self._bicon = wx.Icon(wx.Bitmap(path))
|
||||||
|
self.SetIcon(self._bicon, self._tooltip)
|
||||||
|
|
||||||
|
def setTooltip(self, tooltip):
|
||||||
|
self.SetIcon(self._bicon, tooltip)
|
||||||
|
self._tooltip = tooltip
|
||||||
|
|
||||||
|
def onLeftMouseButton(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def addSeparator(self):
|
||||||
|
self._menu.AppendSeparator()
|
||||||
|
|
||||||
|
def addCommand(self,text,func=lambda:None):
|
||||||
|
item = wx.MenuItem(self._menu,-1,text)
|
||||||
|
self._menu.Bind(wx.EVT_MENU,
|
||||||
|
lambda x:func(),
|
||||||
|
id=item.GetId())
|
||||||
|
self._menu.Append(item)
|
||||||
|
|
||||||
|
def start(self, thread=True):
|
||||||
|
if thread: threading.Thread(
|
||||||
|
target=self._app.MainLoop,
|
||||||
|
daemon=1).start()
|
||||||
|
else: self._app.MainLoop()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
wx.CallAfter(self._app.frame.Close)
|
Loading…
Add table
Add a link
Reference in a new issue