Working corners
This commit is contained in:
parent
66a6b7db70
commit
c538750f3e
3
azot.py
3
azot.py
|
@ -3,4 +3,5 @@ from azot.X import get_geometry, get_cursor_position
|
|||
import azot.config
|
||||
|
||||
|
||||
|
||||
while 1:
|
||||
azot.action.do()
|
||||
|
|
|
@ -1,22 +1,65 @@
|
|||
import os
|
||||
import subprocess
|
||||
import azot.config
|
||||
|
||||
from X import get_cursor_position
|
||||
from time import sleep
|
||||
|
||||
# Globals
|
||||
config = azot.config.load()
|
||||
corners = {
|
||||
'top': config['corners']['top_corner'],
|
||||
'right': config['corners']['right_corner'],
|
||||
'bottom': config['corners']['bottom_corner'],
|
||||
'left': config['corners']['left_corner']
|
||||
}
|
||||
|
||||
|
||||
# Execute command
|
||||
def do(cmd):
|
||||
print string
|
||||
def do():
|
||||
position = get_cursor_position()
|
||||
for action in config['actions']:
|
||||
|
||||
# angles
|
||||
if action['position'] != 'middle':
|
||||
if action['corner'] == 'top' or action['corner'] == 'bottom':
|
||||
if position['y'] == corners[ action['corner'] ] and position['x'] == corners[action['position']]:
|
||||
print action
|
||||
print position
|
||||
print 'Get position: {0} and corner {1}'.format(action['position'], action['corner'])
|
||||
sleep(1)
|
||||
elif action['corner'] == 'left' or action['corner'] == 'right':
|
||||
if position['x'] == corners[ action['position'] ] and position['y'] == corners[ action['corner'] ]:
|
||||
print action
|
||||
print position
|
||||
print 'Get position: {0} and corner {1}'.format(action['position'], action['corner'])
|
||||
sleep(1)
|
||||
|
||||
# middles
|
||||
elif action['position'] == 'middle':
|
||||
if action['corner'] == 'top' or action['corner'] == 'bottom':
|
||||
if position['y'] == corners[ action['corner'] ] and position['x'] > config['corners']['middle_x_start'] and position['x'] < config['corners']['middle_x_end']:
|
||||
print action
|
||||
print position
|
||||
print 'Get position: {0} and corner {1}'.format(action['position'], action['corner'])
|
||||
sleep(1)
|
||||
elif action['corner'] == 'left' or action['corner'] == 'right':
|
||||
if position['x'] == corners[ action['corner'] ] and position['y'] > config['corners']['middle_y_start'] and position['y'] < config['corners']['middle_y_end']:
|
||||
print action
|
||||
print position
|
||||
print 'Get position: {0} and corner {1}'.format(action['position'], action['corner'])
|
||||
sleep(1)
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
# Get shell command output
|
||||
def get_cmd(cmd):
|
||||
out = os.popen(cmd).read()
|
||||
|
||||
return out
|
||||
out = os.popen(cmd).read()
|
||||
|
||||
return out
|
||||
|
||||
|
||||
# Show notify message
|
||||
def notify(msg):
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ def get_middle_areas():
|
|||
middle_y_end = int( middle_y + middle_y_area_pixels )
|
||||
|
||||
corners = { 'left_corner': 0,
|
||||
'right_corner': geometry['x'],
|
||||
'right_corner': geometry['x'] - 1,
|
||||
'top_corner': 0,
|
||||
'bottom_corner': geometry['y'],
|
||||
'bottom_corner': geometry['y'] - 1,
|
||||
'middle_x_start': middle_x_start,
|
||||
'middle_x_end': middle_x_end,
|
||||
'middle_y_start': middle_y_start,
|
||||
|
|
Loading…
Reference in New Issue
Block a user