1
0
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:
Merlijn Wajer 2010-12-01 21:38:20 +01:00
parent 15910ddb9b
commit d7d7472386
7 changed files with 49 additions and 55 deletions

View File

@ -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

View 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

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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