Exemplo n.º 1
0
    def __init__(self):
        cmd.Cmd.__init__(self)
        self.intro = "Tickeys %s - Linux\nType 'help' for help" % __version__
        self.prompt = ">>> "
        self.detecter = KeyboardHandler()
        self.detecter.start_detecting()

        self.volume = self.detecter.get_player_infor()['volume'] * 100.0
        self.pitch = self.detecter.get_player_infor()['pitch'] * 10.0
        self.style = self.detecter.get_player_infor()['style']
Exemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     self.Configer = Configer()
     super(Main, self).__init__(**kwargs)
     self.terminalId = args[0] if args else None
     self.GUIID = None
     # tool works preget
     if self.terminalId:
         stat, GUIID = commands.getstatusoutput('xdotool getactivewindow')
         if stat == 0:
             self.GUIID = GUIID
             # hide itself
             # commands.getstatusoutput(
             #     'xdotool getactivewindow windowminimize')
             self.hide_GUI()
     self.detecter = KeyboardHandler()
     self.detecter.start_detecting()
     self.detecter.GUIID = self.GUIID
     self.hide_terminal()
     show_notify()
Exemplo n.º 3
0
    def __init__(self):
        cmd.Cmd.__init__(self)
        self.intro = "Tickeys %s - Linux\nType 'help' for help" % __version__
        self.prompt = ">>> "
        self.detecter = KeyboardHandler()
        self.detecter.start_detecting()

        self.volume = self.detecter.get_player_infor()["volume"] * 100.0
        self.pitch = self.detecter.get_player_infor()["pitch"] * 10.0
        self.style = self.detecter.get_player_infor()["style"]
Exemplo n.º 4
0
class Main(GridLayout):
    def __init__(self, *args, **kwargs):
        self.Configer = Configer()
        super(Main, self).__init__(**kwargs)
        self.terminalId = args[0] if args else None
        self.GUIID = None
        # tool works preget
        if self.terminalId:
            stat, GUIID = commands.getstatusoutput('xdotool getactivewindow')
            if stat == 0:
                self.GUIID = GUIID
            # hide itself
                commands.getstatusoutput(
                    'xdotool getactivewindow windowminimize')
        self.detecter = KeyboardHandler()
        self.detecter.start_detecting()
        self.detecter.GUIID = self.GUIID
        self.hide_terminal()

    # @property
    # def detecter(self):
    #     return self.detecter

    def hide_terminal(self):
        if not self.terminalId:
            return
        commands.getstatusoutput(
            "xdotool windowactivate --sync %s" % self.terminalId)
        commands.getstatusoutput(
            "xdotool getactivewindow windowunmap")
        # if want to show terminal use windowminimize

    def Exit(self):
        self.detecter.stop_detecting()
        # Show the terminal
        # if self.terminalId:
        #     commands.getstatusoutput(
        #    "xdotool windowactivate --sync %s" % self.terminalId)
        #     commands.getstatusoutput(
        #    "xdotool getactivewindow windowmap")
        sys.exit(0)
Exemplo n.º 5
0
class Main(GridLayout):
    def __init__(self, *args, **kwargs):
        self.Configer = Configer()
        super(Main, self).__init__(**kwargs)
        self.terminalId = args[0] if args else None
        self.GUIID = None
        # tool works preget
        if self.terminalId:
            stat, GUIID = commands.getstatusoutput('xdotool getactivewindow')
            if stat == 0:
                self.GUIID = GUIID
            # hide itself
                # commands.getstatusoutput(
                #     'xdotool getactivewindow windowminimize')
                self.hide_GUI()
        self.detecter = KeyboardHandler()
        self.detecter.start_detecting()
        self.detecter.GUIID = self.GUIID
        self.hide_terminal()
        show_notify()

    # @property
    # def detecter(self):
    #     return self.detecter

    def hide_terminal(self):
        if not self.terminalId:
            return
        commands.getstatusoutput(
            "xdotool windowactivate --sync %s" % self.terminalId)
        commands.getstatusoutput(
            "xdotool getactivewindow windowunmap")
        # if want to show terminal use windowminimize

    def hide_GUI(self):
        try:
            commands.getstatusoutput(
                'xdotool windowunmap --sync %s' % self.GUIID)
        except Exception,e:
            logger.error(str(e))
Exemplo n.º 6
0
class Main(GridLayout):
    def __init__(self, *args, **kwargs):
        self.Configer = Configer()
        super(Main, self).__init__(**kwargs)
        self.terminalId = args[0] if args else None
        self.GUIID = None
        # tool works preget
        if self.terminalId:
            stat, GUIID = commands.getstatusoutput('xdotool getactivewindow')
            if stat == 0:
                self.GUIID = GUIID
                # hide itself
                # commands.getstatusoutput(
                #     'xdotool getactivewindow windowminimize')
                self.hide_GUI()
        self.detecter = KeyboardHandler()
        self.detecter.start_detecting()
        self.detecter.GUIID = self.GUIID
        self.hide_terminal()
        show_notify()

    # @property
    # def detecter(self):
    #     return self.detecter

    def hide_terminal(self):
        if not self.terminalId:
            return
        commands.getstatusoutput("xdotool windowactivate --sync %s" %
                                 self.terminalId)
        commands.getstatusoutput("xdotool getactivewindow windowunmap")
        # if want to show terminal use windowminimize

    def hide_GUI(self):
        try:
            commands.getstatusoutput('xdotool windowunmap --sync %s' %
                                     self.GUIID)
        except Exception, e:
            logger.error(str(e))
Exemplo n.º 7
0
 def __init__(self, *args, **kwargs):
     self.Configer = Configer()
     super(Main, self).__init__(**kwargs)
     self.terminalId = args[0] if args else None
     self.GUIID = None
     # tool works preget
     if self.terminalId:
         stat, GUIID = commands.getstatusoutput('xdotool getactivewindow')
         if stat == 0:
             self.GUIID = GUIID
         # hide itself
             commands.getstatusoutput(
                 'xdotool getactivewindow windowminimize')
     self.detecter = KeyboardHandler()
     self.detecter.start_detecting()
     self.detecter.GUIID = self.GUIID
     self.hide_terminal()
Exemplo n.º 8
0
class CLI(cmd.Cmd):
    def __init__(self):
        cmd.Cmd.__init__(self)
        self.intro = "Tickeys %s - Linux\nType 'help' for help" % __version__
        self.prompt = ">>> "
        self.detecter = KeyboardHandler()
        self.detecter.start_detecting()

        self.volume = self.detecter.get_player_infor()["volume"] * 100.0
        self.pitch = self.detecter.get_player_infor()["pitch"] * 10.0
        self.style = self.detecter.get_player_infor()["style"]

    def default(self, line):
        print "Command '%s' is invalid, try 'help'" % line

    def help_setstyle(self):
        print "Set style, change the sound's effect"

    def do_setstyle(self, arg):
        style_index = raw_input(
            "Input the effect style "
            "(0:bubble 1:mechanical 2:sword 3:typewriter 4:Cherry_G80_3000 5:Cherry_G80_3494) you want:"
        )
        style_list = ["bubble", "mechanical", "sword", "typewriter", "Cherry_G80_3000", "Cherry_G80_3494"]

        try:
            style_index = int(style_index)
            assert 0 <= style_index <= 5
        except Exception:
            print "Input must between 0~5!!"
            return

        self.style = style_list[style_index]
        self.detecter.set_style(self.style)

    def help_setvol(self):
        print "Set volume, input the volume you want"

    def do_setvol(self, arg):
        volume = raw_input("Input the volume(0~100) you want:")

        try:
            volume = float(volume)
            assert 0 <= volume <= 100
        except Exception:
            print "Volume must between 0~100!!"
            return

        self.volume = volume
        self.detecter.set_volume(self.volume / 100.0)

    def help_getvol(self):
        print "Get the volume"

    def do_getvol(self, arg):
        print self.volume

    def help_setpitch(self):
        print "Set pitch, input the pitch you want"

    def do_setpitch(self, arg):
        pitch = raw_input("Input the pitch(0~30, default 10) you want:")

        try:
            pitch = float(pitch)
            assert 0 <= pitch <= 30
        except Exception:
            print "Pitch must between 0~30!!"
            return

        self.pitch = pitch
        self.detecter.set_pitch(self.pitch / 10.0)

    def help_getpitch(self):
        print "Get the pitch"

    def do_getpitch(self, arg):
        print self.pitch

    def help_getinfor(self):
        print "Get tickeys' sound effect, volume and pitch"

    def do_getinfor(self, arg):
        print "Sound effect: %s  Volume: %s  Pitch: %s" % (self.style, self.volume, self.pitch)

    def do_quit(self, arg):
        try:
            self.detecter.stop_detecting()
        except Exception:
            pass
        finally:
            sys.exit(0)
            return True
Exemplo n.º 9
0
class CLI(cmd.Cmd):
    def __init__(self):
        cmd.Cmd.__init__(self)
        self.intro = "Tickeys %s - Linux\nType 'help' for help" % __version__
        self.prompt = ">>> "
        self.detecter = KeyboardHandler()
        self.detecter.start_detecting()

        self.volume = self.detecter.get_player_infor()['volume'] * 100.0
        self.pitch = self.detecter.get_player_infor()['pitch'] * 10.0
        self.style = self.detecter.get_player_infor()['style']

    def default(self, line):
        print "Command '%s' is invalid, try 'help'" % line

    def help_setstyle(self):
        print "Set style, change the sound's effect"

    def do_setstyle(self, arg):
        style_index = raw_input(
            "Input the effect style "
            "(0:bubble 1:mechanical 2:sword 3:typewriter) you want:")
        style_list = ['bubble', 'mechanical', 'sword', 'typewriter']

        try:
            style_index = int(style_index)
            assert (0 <= style_index <= 3)
        except Exception:
            print "Input must between 0~3!!"
            return

        self.style = style_list[style_index]
        self.detecter.set_style(self.style)

    def help_setvol(self):
        print "Set volume, input the volume you want"

    def do_setvol(self, arg):
        volume = raw_input("Input the volume(0~100) you want:")

        try:
            volume = float(volume)
            assert (0 <= volume <= 100)
        except Exception:
            print "Volume must between 0~100!!"
            return

        self.volume = volume
        self.detecter.set_volume(self.volume / 100.0)

    def help_getvol(self):
        print "Get the volume"

    def do_getvol(self, arg):
        print self.volume

    def help_setpitch(self):
        print "Set pitch, input the pitch you want"

    def do_setpitch(self, arg):
        pitch = raw_input("Input the pitch(0~30, default 10) you want:")

        try:
            pitch = float(pitch)
            assert (0 <= pitch <= 30)
        except Exception:
            print "Pitch must between 0~30!!"
            return

        self.pitch = pitch
        self.detecter.set_pitch(self.pitch / 10.0)

    def help_getpitch(self):
        print "Get the pitch"

    def do_getpitch(self, arg):
        print self.pitch

    def help_getinfor(self):
        print "Get tickeys' sound effect, volume and pitch"

    def do_getinfor(self, arg):
        print "Sound effect: %s  Volume: %s  Pitch: %s" \
            % (self.style, self.volume, self.pitch)

    def do_quit(self, arg):
        try:
            self.detecter.stop_detecting()
        except Exception:
            pass
        finally:
            sys.exit(0)
            return True
Exemplo n.º 10
0
    else:
        # Set default values.
        GUI_HEIGHT = 2  #in text lines
        GUI_WIDTH = 40  #in text characters
        FONTSIZE = 25  #text font size
        GUI_CORNER_PLACEMENT = GUI_AVAILABLE_PLACEMENT[0]
        BG = "peachpuff"
        TXTCOLOR = "black"
        DCM = False
        PRST = False
        SPACES = True
        PREFIX_NUMBER = 2

    # Initialize the Word Completer and Keyboard Handler.
    WC = WordCompleter(WC_pkl_file, PREFIX_NUMBER)
    KbH = KeyboardHandler(WC, GUI_Q, SPACES, DCM)

    # SysTrayIcon argument parameters
    hovertext = "Automatic Word Completion"
    icon = os.getcwd() + "/" + "Speech_Bubble_Icon.ico"
    menu_options = (('Options', icon, options), )

    # Threaded class initialization
    SysTray = SysTrayIcon(KbH,
                          icon,
                          hovertext,
                          menu_options,
                          default_menu_index=0)
    WSG = WSGui(BG, GUI_CORNER_PLACEMENT, DCM, FONTSIZE, TXTCOLOR, GUI_Q,
                GUI_HEIGHT, GUI_WIDTH)