Add files via upload
This commit is contained in:
parent
815a7bea90
commit
db05a386cb
11 changed files with 132 additions and 13 deletions
|
@ -7,6 +7,7 @@ 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 *
|
||||||
|
|
File diff suppressed because one or more lines are too long
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)
|
|
@ -1,8 +1,9 @@
|
||||||
from pygwin.surface import surface as _surface
|
from pygwin.surface import surface as _surface
|
||||||
|
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
|
||||||
# import pygwin._icon as _icon
|
import pygwin._icon as _icon
|
||||||
import pygwin.image as _img
|
import pygwin.image as _img
|
||||||
import win32job as _w32j
|
import win32job as _w32j
|
||||||
import win32api as _w32a
|
import win32api as _w32a
|
||||||
|
@ -13,12 +14,14 @@ import tempfile as _tf
|
||||||
import pickle as _p
|
import pickle as _p
|
||||||
|
|
||||||
class win(_surface):
|
class win(_surface):
|
||||||
def __init__(self):
|
def __init__(self, iconpath):
|
||||||
self._orig = _pg.display.get_surface()
|
self._orig = _pg.display.get_surface()
|
||||||
super().__init__(self._orig.get_size())
|
super().__init__(self._orig.get_size())
|
||||||
self._orig = _pg.display.get_surface()
|
self._orig = _pg.display.get_surface()
|
||||||
self._clock = _pg.time.Clock()
|
self._clock = _pg.time.Clock()
|
||||||
self._withfps = False
|
self._withfps = False
|
||||||
|
self._iconpath = iconpath
|
||||||
|
self.tray = _tray(_pg.display.get_caption(),self._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)
|
||||||
|
@ -37,6 +40,7 @@ class win(_surface):
|
||||||
title = property(**title())
|
title = property(**title())
|
||||||
def icon(value):
|
def icon(value):
|
||||||
_pg.display.set_icon(_pg.image.load(value))
|
_pg.display.set_icon(_pg.image.load(value))
|
||||||
|
self._iconpath = iconpath
|
||||||
def size():
|
def size():
|
||||||
def fget(self):
|
def fget(self):
|
||||||
return _pg.display.get_window_size()
|
return _pg.display.get_window_size()
|
||||||
|
@ -104,13 +108,14 @@ 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))
|
||||||
# else:
|
else:
|
||||||
# surf = _img.fromBytes(_icon.iconbytes)
|
surf = _img.fromBytes(_icon.iconbytes)
|
||||||
# try:
|
try:
|
||||||
# orig = surf._surface_orig
|
orig = surf._surface_orig
|
||||||
# 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):
|
||||||
|
|
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,6 +2,7 @@ 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
|
||||||
|
|
|
@ -3,4 +3,4 @@ pywin32
|
||||||
pygame
|
pygame
|
||||||
inputs
|
inputs
|
||||||
pydub
|
pydub
|
||||||
kivy
|
wxPython
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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 *
|
||||||
|
|
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)
|
|
@ -1,4 +1,5 @@
|
||||||
from pygwin.surface import surface as _surface
|
from pygwin.surface import surface as _surface
|
||||||
|
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
|
||||||
|
@ -13,12 +14,14 @@ import tempfile as _tf
|
||||||
import pickle as _p
|
import pickle as _p
|
||||||
|
|
||||||
class win(_surface):
|
class win(_surface):
|
||||||
def __init__(self):
|
def __init__(self, iconpath):
|
||||||
self._orig = _pg.display.get_surface()
|
self._orig = _pg.display.get_surface()
|
||||||
super().__init__(self._orig.get_size())
|
super().__init__(self._orig.get_size())
|
||||||
self._orig = _pg.display.get_surface()
|
self._orig = _pg.display.get_surface()
|
||||||
self._clock = _pg.time.Clock()
|
self._clock = _pg.time.Clock()
|
||||||
self._withfps = False
|
self._withfps = False
|
||||||
|
self._iconpath = iconpath
|
||||||
|
self.tray = _tray(_pg.display.get_caption(),self._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)
|
||||||
|
@ -37,6 +40,7 @@ class win(_surface):
|
||||||
title = property(**title())
|
title = property(**title())
|
||||||
def icon(value):
|
def icon(value):
|
||||||
_pg.display.set_icon(_pg.image.load(value))
|
_pg.display.set_icon(_pg.image.load(value))
|
||||||
|
self._iconpath = iconpath
|
||||||
def size():
|
def size():
|
||||||
def fget(self):
|
def fget(self):
|
||||||
return _pg.display.get_window_size()
|
return _pg.display.get_window_size()
|
||||||
|
@ -111,6 +115,7 @@ 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):
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -3,4 +3,4 @@ import requests
|
||||||
|
|
||||||
setup(name='pygwin',packages=['pygwin'],version='0.1.0',author='themixray',
|
setup(name='pygwin',packages=['pygwin'],version='0.1.0',author='themixray',
|
||||||
description='A library for creating Python applications.',license='MIT',
|
description='A library for creating Python applications.',license='MIT',
|
||||||
install_requires=['cython','pywin32','pygame','inputs','pydub','kivy'])
|
install_requires=['cython','pywin32','pygame','inputs','pydub','wxPython'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue