Adding the image viewer

This commit is contained in:
Anonymus Raccoon
2020-04-25 17:07:28 +02:00
parent 08121662d9
commit b55b830051
10 changed files with 31 additions and 4 deletions
+1 -1
View File
@@ -11,4 +11,4 @@ class CommandHelper:
@staticmethod
def run_async(cmd):
with open(os.devnull, 'wb') as devnull:
return subprocess.Popen(cmd.split(' '), stdout=devnull, stderr=subprocess.STDOUT)
return subprocess.Popen(cmd.split(' '), stdout=devnull, stderr=subprocess.STDOUT)

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 135 KiB

-1
View File
@@ -94,4 +94,3 @@ class Term:
if shutil.which(term) is not None:
Term.terminal = term
return term
+4 -2
View File
@@ -28,9 +28,11 @@ class Trick(ABC):
@staticmethod
def get_random_trick():
from Tricks.laughing_goose import LaughingGooseTrick
from tricks.laughing_goose import LaughingGooseTrick
from tricks.glorify_goose import GlorifyGooseTrick
tricks = [
LaughingGooseTrick
LaughingGooseTrick,
GlorifyGooseTrick
]
return random.choice(tricks)()
+26
View File
@@ -0,0 +1,26 @@
import os
import random
from command_helper import CommandHelper
from trick import Trick
class GlorifyGooseTrick(Trick):
@property
def name(self):
return "Glorify goose"
@property
def delay(self):
return 5
@property
def is_reversible(self):
return False
def revert(self):
pass
def run(self):
images = os.listdir("data/glorify")
CommandHelper.run_async(f"xdg-open data/glorify/{random.choice(images)}")