Jai MERGE TOUT SEUL

This commit is contained in:
jeremy
2020-04-25 19:30:43 +02:00
3 changed files with 32 additions and 3 deletions

View File

@@ -33,11 +33,13 @@ class Trick(ABC):
from tricks.glorify_goose import GlorifyGooseTrick
from tricks.anim_ascii import AnimAsciiTrick
from tricks.reflection import ReflectionTrick
from tricks.rotation import RotationTrick
tricks = [
LaughingGooseTrick,
GlorifyGooseTrick,
AnimAsciiTrick,
ReflectionTrick
ReflectionTrick,
RotationTrick
]
return random.choice(tricks)()

View File

@@ -1,8 +1,8 @@
import time
import os
import random
from trick import Trick
from command_helper import CommandHelper
class ReflectionTrick(Trick):
@@ -22,6 +22,7 @@ class ReflectionTrick(Trick):
pass
def run(self):
os.system("xrandr --output $(xrandr -q | grep ' connected' | cut -f 1 -d ' ' | cut -f 1 -d '\n') --reflect x")
selected = random.choice(["x", "y", "xy"])
os.system(f"xrandr --output $(xrandr -q | grep ' connected' | cut -f 1 -d ' ' | cut -f 1 -d '\n') --reflect {selected}")
time.sleep(5)
os.system("xrandr --output $(xrandr -q | grep ' connected' | cut -f 1 -d ' ' | cut -f 1 -d '\n') --reflect normal")

26
tricks/rotation.py Normal file
View File

@@ -0,0 +1,26 @@
import time
import os
from trick import Trick
class RotationTrick(Trick):
@property
def name(self):
return "Rotation"
@property
def delay(self):
return 5
@property
def is_reversible(self):
return False
def revert(self):
pass
def run(self):
os.system("xrandr --output $(xrandr -q | grep ' connected' | cut -f 1 -d ' ' | cut -f 1 -d '\n') --rotation inverted")
time.sleep(5)
os.system("xrandr --output $(xrandr -q | grep ' connected' | cut -f 1 -d ' ' | cut -f 1 -d '\n') --rotation normal")