-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.添加新音效(爆裂鼓手) 2.修改界面,现在显示中文 3.修改音效显示名称 4.修复一个键盘监测bug 5.再次运行程序自动打开设置界面
- Loading branch information
1 parent
80d828f
commit 4212644
Showing
10 changed files
with
106 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
__author__ = 'Huang Xiongbiao' | ||
__email__ = '[email protected]' | ||
__version__ = '0.2.2' | ||
debug_mode = True | ||
debug_mode = False | ||
|
||
from run import main | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,12 @@ | |
import threading | ||
from evdev import InputDevice | ||
from select import select | ||
from SoundPlayer import SoundPlayer | ||
from soundPlayer import SoundPlayer | ||
from logger import logger | ||
import commands | ||
|
||
from windowManager import show_GUI | ||
|
||
__author__ = 'Huang xiongbiao([email protected])' | ||
|
||
# input device file path | ||
|
@@ -24,7 +26,6 @@ def __init__(self): | |
self.inputRecord = [] | ||
self.hotKey = [16, 30, 44, 2, 3, 4] # QAZ123 | ||
self.sp = SoundPlayer() | ||
self.GUIID = None | ||
self.show_device() | ||
|
||
# list all event's name and its device | ||
|
@@ -48,17 +49,6 @@ def set_pitch(self, pitch): | |
def get_player_infor(self): | ||
return self.sp.get_infor() | ||
|
||
@property | ||
def GUIID(self): | ||
return self.GUIID | ||
|
||
def show_GUI(self): | ||
if not self.GUIID: | ||
return | ||
# command = "xdotool windowactivate --sync %s" % self.GUIID | ||
command = "xdotool windowmap --sync %s && xdotool windowactivate --sync %s" % (self.GUIID, self.GUIID) | ||
commands.getstatusoutput(command) | ||
|
||
# new way to find keyboard | ||
# return with a list of keyboard's event | ||
def find_keyboard(self): | ||
|
@@ -127,7 +117,7 @@ def check_show_window(self, keycode): | |
self.inputRecord.append(keycode) | ||
logger.debug(self.inputRecord) | ||
if len(self.inputRecord) == 6: | ||
self.show_GUI() | ||
show_GUI() | ||
self.inputRecord = [] | ||
else: | ||
self.inputRecord = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,12 @@ | |
from logger import logger | ||
import sys | ||
import os | ||
import commands | ||
import json | ||
import requests | ||
from threading import Thread | ||
|
||
__version__ = '0.2.1' | ||
from windowManager import save_terminal_window_id, check_tickeys_running_status | ||
|
||
__version__ = '0.2.2' | ||
__author__ = 'Huang xiongbiao([email protected])' | ||
|
||
|
||
|
@@ -17,13 +17,8 @@ def run_GUI(): | |
Thread(target=check_update, args=()).start() | ||
check_system() | ||
try: | ||
stat, terminalId = commands.getstatusoutput('xdotool getactivewindow') | ||
from GUI import TickeysApp | ||
if stat == 0: | ||
TickeysApp(terminalId).run() | ||
else: | ||
TickeysApp().run() | ||
|
||
TickeysApp().run() | ||
except Exception, e: | ||
logger.info("Run GUI Fail, use CLI instead..Fail msg:%s" % str(e)) | ||
run_CLI() | ||
|
@@ -48,6 +43,7 @@ def check_root(): | |
|
||
def check_update(): | ||
try: | ||
import requests | ||
logger.info("Version checking...") | ||
r = requests.get("http://billbill.sinaapp.com/tickeys") | ||
returnInfor = json.loads(r.text) | ||
|
@@ -92,6 +88,9 @@ def print_help_msg(): | |
|
||
def main(): | ||
logger.debug("Tickeys start........") | ||
is_running = check_tickeys_running_status() | ||
if is_running: | ||
return | ||
if len(sys.argv) == 1: | ||
run_GUI() | ||
elif len(sys.argv) == 2: | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# coding: utf-8 | ||
import commands | ||
|
||
from logger import logger | ||
|
||
|
||
def save_terminal_window_id(): | ||
try: | ||
stat, terminalId = commands.getstatusoutput('xdotool getactivewindow') | ||
assert stat == 0 | ||
with open("/tmp/tickeys_terminal_window_id", "w+") as f: | ||
f.write(terminalId) | ||
except Exception, e: | ||
logger.error("Save terminal window id fail:" + str(e)) | ||
|
||
|
||
def read_terminal_window_id(): | ||
with open("/tmp/tickeys_terminal_window_id", "r") as f: | ||
return f.read() | ||
|
||
|
||
def hide_terminal(): | ||
try: | ||
terminalId = read_terminal_window_id() | ||
if not terminalId: | ||
return | ||
commands.getstatusoutput( | ||
"xdotool windowactivate --sync %s" % terminalId) | ||
commands.getstatusoutput( | ||
"xdotool getactivewindow windowunmap") | ||
except Exception,e: | ||
logger.error(str(e)) | ||
|
||
|
||
def save_GUI_window_id(): | ||
try: | ||
stat, GUIID = commands.getstatusoutput('xdotool getactivewindow') | ||
assert stat == 0 | ||
with open("/tmp/tickeys_GUI_window_id", "w+") as f: | ||
f.write(GUIID) | ||
except Exception, e: | ||
logger.error("Save GUI window id fail:" + str(e)) | ||
|
||
|
||
def read_GUI_window_id(): | ||
with open("/tmp/tickeys_GUI_window_id", "r") as f: | ||
return f.read() | ||
|
||
|
||
def hide_GUI(): | ||
try: | ||
GUIID = read_GUI_window_id() | ||
commands.getstatusoutput( | ||
'xdotool windowunmap --sync %s' % GUIID) | ||
except Exception,e: | ||
logger.error(str(e)) | ||
|
||
|
||
def show_GUI(): | ||
try: | ||
GUIID = read_GUI_window_id() | ||
if not GUIID: | ||
return | ||
# read window ids | ||
command = "xdotool windowmap --sync %s && xdotool windowactivate --sync %s" % (GUIID, GUIID) | ||
stat, output = commands.getstatusoutput(command) | ||
return str(stat) | ||
except Exception, e: | ||
logger.error(str(e)) | ||
return '256' | ||
|
||
def check_tickeys_running_status(): | ||
save_terminal_window_id() | ||
stat = show_GUI() | ||
if stat != "0": | ||
return False | ||
else: | ||
print "Tickeys is already running, show it" | ||
hide_terminal() | ||
return True |