mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-21 08:45:06 -05:00
New MML structure + additions.
This commit is contained in:
parent
15910ddb9b
commit
d7d7472386
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from ctypes import *
|
||||
from mmlmouse import Mouse
|
||||
from mmlcolor import Color
|
||||
from mouse import Mouse
|
||||
from color import Color
|
||||
from time import sleep
|
||||
from mmltypes import PINTEGER
|
||||
from mtypes import PINTEGER
|
||||
|
||||
class MMLCoreException(Exception):
|
||||
def __init__(self, err):
|
||||
@ -46,40 +46,3 @@ class MMLCore(object):
|
||||
def __del__(self):
|
||||
del self.dll
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
DLL = MMLCore('../libmml.so')
|
||||
|
||||
client = DLL.dll.create_client()
|
||||
print 'Python Client: %d' % client
|
||||
if client in (0, 1):
|
||||
raise Exception('Could create a client');
|
||||
|
||||
c = Color(DLL, client)
|
||||
|
||||
|
||||
ret = c.find((0, 0, 100, 100), 0)
|
||||
print ret
|
||||
|
||||
ret = c.findAll((0, 0, 100, 100), 0, tol=100)
|
||||
print ret
|
||||
|
||||
m = Mouse(DLL, client)
|
||||
|
||||
|
||||
print m[(Mouse.Pos, Mouse.Left, Mouse.Right)]
|
||||
m[(Mouse.Pos, Mouse.Right)] = ((300,300), True)
|
||||
|
||||
print m.getButtonStates()
|
||||
sleep(0.5)
|
||||
m.setPos((200,200))
|
||||
|
||||
sleep(2)
|
||||
print 'Done'
|
||||
|
||||
m[(Mouse.Left, Mouse.Right, Mouse.Middle)] = [False for x in range(3)]
|
||||
for v in zip((Mouse.Left, Mouse.Right), m[(Mouse.Left, Mouse.Right)]):
|
||||
print v
|
||||
print m.getPos()
|
||||
|
||||
del DLL
|
38
Projects/libmml/pymml/mml/__main__.py
Normal file
38
Projects/libmml/pymml/mml/__main__.py
Normal file
@ -0,0 +1,38 @@
|
||||
from __init__ import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
DLL = MMLCore('../libmml.so')
|
||||
|
||||
client = DLL.dll.create_client()
|
||||
print 'Python Client: %d' % client
|
||||
if client in (0, 1):
|
||||
raise Exception('Could create a client');
|
||||
|
||||
c = Color(DLL, client)
|
||||
|
||||
|
||||
ret = c.find((0, 0, 100, 100), 0)
|
||||
print ret
|
||||
|
||||
ret = c.findAll((0, 0, 100, 100), 0, tol=100)
|
||||
print ret
|
||||
|
||||
m = Mouse(DLL, client)
|
||||
|
||||
|
||||
print m[(Mouse.Pos, Mouse.Left, Mouse.Right)]
|
||||
m[(Mouse.Pos, Mouse.Right)] = ((300,300), True)
|
||||
|
||||
print m.getButtonStates()
|
||||
sleep(0.5)
|
||||
m.setPos((200,200))
|
||||
|
||||
sleep(2)
|
||||
print 'Done'
|
||||
|
||||
m[(Mouse.Left, Mouse.Right, Mouse.Middle)] = [False for x in range(3)]
|
||||
for v in zip((Mouse.Left, Mouse.Right), m[(Mouse.Left, Mouse.Right)]):
|
||||
print v
|
||||
print m.getPos()
|
||||
|
||||
del DLL
|
@ -2,18 +2,11 @@
|
||||
|
||||
class Bitmap(object):
|
||||
|
||||
# Pixels, alleen ter illustratie atm
|
||||
pixels = None
|
||||
|
||||
# Index van de managed bitmaps
|
||||
_index = None
|
||||
def __init__(self):
|
||||
self.pixels = [range(100) for x in range(100)]
|
||||
pass
|
||||
|
||||
def __getitem__(self, item):
|
||||
if iterable(item):
|
||||
return self.pixels[item[0]][item[1]]
|
||||
pass
|
||||
|
||||
def find(self, searchbox = (), tol = 0, frm = (), _type = 'default', client
|
||||
= None):
|
@ -1,8 +1,8 @@
|
||||
from ctypes import *
|
||||
from mmltypes import isiterable
|
||||
from mmltypes import POINT, PPOINT, PINTEGER
|
||||
from mmltypes import RESULT_OK, RESULT_FALSE, RESULT_ERROR
|
||||
from mmltypes import MMLException
|
||||
from mtypes import isiterable
|
||||
from mtypes import POINT, PPOINT, PINTEGER
|
||||
from mtypes import RESULT_OK, RESULT_FALSE, RESULT_ERROR
|
||||
from mtypes import MMLException
|
||||
|
||||
"""
|
||||
The Color Class
|
@ -1,5 +1,5 @@
|
||||
from ctypes import *
|
||||
from mmltypes import RESULT_OK, RESULT_FALSE, RESULT_ERROR
|
||||
from mtypes import RESULT_OK, RESULT_FALSE, RESULT_ERROR
|
||||
|
||||
# There are several problems with DTM and libMML.
|
||||
# We could create them in the libMML DTM manager, but we'll have to keep track
|
@ -1,6 +1,6 @@
|
||||
from ctypes import *
|
||||
from mmltypes import POINT, PPOINT
|
||||
from mmltypes import isiterable
|
||||
from mtypes import POINT, PPOINT
|
||||
from mtypes import isiterable
|
||||
|
||||
"""
|
||||
The Mouseclass
|
Loading…
Reference in New Issue
Block a user