def initializeTray(self):
     self.tray = Tray(self, self.iface)
     self.cw.operation.finished.connect(self.trayAction)
     self.cw.operation.finished.connect(self.tray.stop)
     self.cw.operation.operationCancelled.connect(self.tray.stop)
     self.cw.operation.started.connect(self.tray.animate)
     self.tray.showUpdatesSelected.connect(self.trayShowUpdates)
示例#2
0
    def init(self):
        self.load_data('data')
        self.load_data('config')
        # 初始化分辨率
        if self.config['resolving'] == [0, 0]:
            self.config['resolving'] = self.resolving
            self.dump_data('config')
        else:
            self.resolving = self.config['resolving']
        for api in self.all_api[1:]:
            exec('self.%s = %s(self)' % (api, api))

        self.tray = Tray(self)
        self.switch_frame = SwitchFrame(self)
        self.right_frame = Right(self)
        self.set = Set(self)
        # 检查权限
        if not try_author():
            self.set.auto_start.setEnabled(False)

        self.choose_random = ChooseRandom(self.set, self)
        self.local_api = LocalWallpaper(self)
        self.verify = Verify(self)
        self.local_api.init_check()

        # qss
        with open('style.qss', 'r') as fp:
            self.setStyleSheet(fp.read())

        self.initializing = False
        if self.config['show_windmill'] == 0:
            self.hide()
        else:
            self.show()
示例#3
0
文件: main.py 项目: DZZ95/invoker
 def init(self):
     self.tray = Tray(self)
     self.head = Head(self)
     self.agenda = Agenda(self)
     self.set = Set(self)
     # qss
     with open('style.QSS', 'r') as fp:
         self.setStyleSheet(fp.read())
         fp.close()
示例#4
0
 def initializeTray(self):
     self.tray = Tray(self, self.iface)
     self.connect(self.cw.operation, SIGNAL("finished(QString)"),
                  self.trayAction)
     self.connect(self.cw.operation, SIGNAL("finished(QString)"),
                  self.tray.stop)
     self.connect(self.cw.operation, SIGNAL("operationCancelled()"),
                  self.tray.stop)
     self.connect(self.cw.operation, SIGNAL("started(QString)"),
                  self.tray.animate)
     self.connect(self.tray, SIGNAL("showUpdatesSelected()"),
                  self.trayShowUpdates)
示例#5
0
    def __init__(self):
        WindowBaseClass.__init__(self)
        self.setupUi(self)
        self._explicitQuit = False

        # Tunnels
        self._tunnels = []

        # Setup tray
        self.tray = Tray(self, "IOSSHy", QIcon(":/icons/network-server.png"))
        self.tray.activated.connect(self.activated)

        action = QAction("&Configure", self.tray.menu)
        action.setIcon(QIcon(":/icons/configure.png"))
        action.triggered.connect(self.show)
        self.tray.menu.addAction(action)
        self.tray.menu.setDefaultAction(action)

        self.tray.menu.addSeparator()
        self.actionNoTun = QAction("No tunnels configured", self.tray.menu)
        self.actionNoTun.setEnabled(False)
        self.tray.menu.addAction(self.actionNoTun)
        self.actionLastSep = self.tray.menu.addSeparator()

        if kde:
            action = QAction("&About", self.tray.menu)
            action.triggered.connect(self.about)
            self.tray.menu.addAction(action)

        action = QAction("&Quit", self.tray.menu)
        action.setIcon(QIcon(":/icons/application-exit.png"))
        action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
        action.triggered.connect(self.quit)
        self.tray.menu.addAction(action)

        # Load settings
        self.readSettings()
        self.hide()
示例#6
0
    def init(self):
        self.load_data('data')
        self.load_data('config')
        for api in self.all_api[1:]:
            exec('self.%s = %s(self)' % (api, api))
        self.tray = Tray(self)
        self.switch_frame = SwitchFrame(self)
        self.switch_frame.change_interval()
        self.right_frame = Right(self)
        self.set = Set(self)
        self.set.api_choose.addItems(self.all_api)
        self.set.api_choose.setCurrentText(self.config['api'])
        if self.config['api'] != '随机':
            self.api = eval('self.%s' % self.config['api'])
            self.set.category_choose.addItems(self.api.cate)
            self.set.category_choose.setCurrentText(self.config['category'])
            if self.config['play_like'] != 0:
                self.set.api_choose.setEnabled(False)
                self.set.category_choose.setEnabled(False)
        else:
            self.set.category_choose.addItem('随机')
            self.set.category_choose.setCurrentText('随机')
        # 检查权限
        if not try_author():
            self.set.auto_start.setEnabled(False)

        self.choose_random = ChooseRandom(self.set, self)
        # qss
        with open('style.qss', 'r') as fp:
            self.setStyleSheet(fp.read())

        self.initializing = False
        if self.config['show_windmill'] == 0:
            self.hide()
        else:
            self.show()
示例#7
0
 def initializeTray(self):
     self.tray = Tray(self)
示例#8
0
 def initializeTray(self):
     self.tray = Tray(self)
     self.connect(self.centralWidget().operation, SIGNAL("finished(QString)"), self.trayShow)
     self.connect(self.tray, SIGNAL("showUpdatesSelected()"), self.trayShowUpdates)
示例#9
0
    if os.path.isfile(qtconf):
        os.remove(qtconf)
    qtconf_file = open(qtconf, mode='w')
    qtconf_file.write('[Paths]\n')
    qtconf_file.write('Prefix = ' + pyqt4dir + '\n')
    qtconf_file.write('Binaries = ' + pyqt4dir + '\n')
    qtconf_file.close()

from cgrupyqt import QtGui

import cgruconfig
import cmd
from refresh import Refresh
from tray import Tray
from server import Server

# Define keeper launch command if was not:
keeper_cmd = os.getenv('CGRU_KEEPER_CMD')
if keeper_cmd is None:
    keeper_cmd = '"%s" "%s"' % (os.getenv('CGRU_PYTHONEXE'), sys.argv[0])
cgruconfig.VARS['CGRU_KEEPER_CMD'] = keeper_cmd

# Create tray application with refresh:
app = QtGui.QApplication(sys.argv)
app.setQuitOnLastWindowClosed(False)
cmd.Application = app
cmd.Tray = Tray(app)
refresh = Refresh(app)
server = Server(app)
app.exec_()
示例#10
0
    def __init__(self):
        QMainWindow.__init__(self)

        self.setWindowTitle(cons.APP_TITLE)
        self.setWindowIcon(
            QIcon(os.path.join(cons.MEDIA_PATH, "misc", "ochd.ico")))
        self.resize(MIN_WIDTH, MIN_HEIGHT)
        self.center()

        self.restore_wnd_geometry()

        self.stop = (QToolButton(), media.get_icon(media.STOP, media.MEDIUM),
                     _('Stop Download'), self.on_stop_download, False)
        self.start = (QToolButton(), media.get_icon(media.START, media.MEDIUM),
                      _('Start Download'), self.on_start_download, False)
        accounts = (QToolButton(), media.get_icon(media.ACCOUNTS,
                                                  media.MEDIUM), _('Accounts'),
                    self.on_accounts, True)
        preferences = (QToolButton(),
                       media.get_icon(media.PREFERENCES, media.MEDIUM),
                       _('Preferences'), self.on_preferences, True)
        about = (QToolButton(), media.get_icon(media.ABOUT, media.MEDIUM),
                 _('About'), self.on_about, True)

        self.menu = QMenu()
        preferences[BTN].setPopupMode(QToolButton.MenuButtonPopup)
        preferences[BTN].setMenu(self.menu)

        toolbar = Toolbar(
            self,
            [self.start, self.stop, None, accounts, preferences, None, about])

        self.toolbar = self.addToolBar(toolbar)

        #self.vbox = QVBoxLayout(self)

        #tabs
        self.previous_tab = None
        self.tab = QTabWidget(self)
        #
        self.downloads = Downloads(self)
        self.tab.addTab(self.downloads, _('Downloads'))
        #
        self.add_downloads = AddDownloads(self.downloads, self)
        self.tab_add_downloads = QWidget()
        self.tab_add_downloads.setLayout(self.add_downloads)
        self.tab.addTab(self.tab_add_downloads, _('Add downloads'))
        #
        #addons
        self.addons_manager = AddonsManager(self)
        self.addons_list = self.addons_manager.addons_list
        #...tabs
        self.addon_tab_widgets = []
        self.load_addon_tabs()
        #
        self.log = Log()
        self.tab_log = QWidget()
        self.tab_log.setLayout(self.log)
        self.tab.addTab(self.tab_log, _('Log'))
        #
        self.preferences = Preferences(self.addons_list, self)
        #self.tab.addTab(self.preferences, 'Preferences')
        #
        self.tab.currentChanged.connect(self.on_tab_switch)
        #
        self.setCentralWidget(self.tab)

        #status bar
        self.status_bar = StatusBar(self)
        self.setStatusBar(self.status_bar)

        #drop down menu
        [addon.set_menu_item() for addon in self.addons_list]
        #self.menu.addSeparator()
        #self.menu.addAction('Preferences', self.on_preferences)

        #system tray icon
        self.tray = Tray(self)
        if self.tray.available:
            self.can_close = False
        else:
            self.can_close = True

        #on select button state
        self.downloads.selectionModel().selectionChanged.connect(
            self.on_selected)

        #load session.
        self.load_session()

        #add core's event loop
        self.idle_timeout(500, self.queue_loop)

        #quit event
        events.connect(cons.EVENT_QUIT, self.event_close)

        self.show()
示例#11
0
    def __init__(self,
                 n_trays,
                 feed_tray,
                 feed_stream_liq,
                 reflux,
                 vapor_reboil,
                 condensate,
                 bottoms,
                 pressure,
                 tray_efficiency=1.0,
                 name=None):
        '''
        feed_tray must be an integer between 1 and n_trays-2 (feed cannot be to the top or bottom trays for now)
        the bottom tray is tray number zero
        the top tray is tray number n_trays-1
        
        the default efficiency is 1 for all trays.
        if tray_efficiency is a scalar, it is used for all trays.
        if tray_efficiency is a dict (tray:efficiency), it is used for the specified trays. the remaining are
        assigned an efficiency of 1.
        '''
        self.column_num = SimpleColumn.n_columns
        super().__init__(name, self.column_num)
        SimpleColumn.n_columns += 1

        assert n_trays > 0, '{}: Number of tray must be greater than zero (specified {})'.format(
            self.name, n_trays)
        self.n_trays = n_trays

        assert (feed_tray >= 1) and (feed_tray <= self.n_trays-2), \
            '{}: Feed tray number must be from 1 to {} inclusive (specified {}). No feed to the top or bottom trays for now' \
            .format(self.name, self.n_trays-2, feed_tray)
        self.feed_tray = feed_tray

        self.feed_stream_liq = feed_stream_liq
        self.reflux = reflux
        self.vapor_reboil = vapor_reboil
        self.condensate = condensate
        self.bottoms = bottoms
        self.pressure = pressure
        self.n_vars = 0
        self.n_eqns = 0
        self.xvar = None
        self.eqns = None

        # figure out number of streams to be created as part of this column
        # for each tray, there are two streams leaving (one liquid, one vapor)
        # one liquid feed stream (comes from outside the column)
        # one stream that is a combination of the liquid feed stream and the liquid from the tray above the feed tray

        # create the streams associated with the column
        # tray liquid and vapor streams
        self.tray_liq_stream = []
        for i_tray in range(self.n_trays):
            name = self.name + 'Tray' + str(i_tray) + 'Liquid'
            #            self.tray_liq_stream.append(Stream(n_comps=N_COMPS, name=name))
            self.tray_liq_stream.append(
                Stream(n_comps=self.feed_stream_liq.n_comps, name=name))

        self.tray_vap_stream = []
        for i_tray in range(self.n_trays):
            name = self.name + 'Tray' + str(i_tray) + 'Vapor'
            #            self.tray_vap_stream.append(Stream(n_comps=N_COMPS, name=name))
            self.tray_vap_stream.append(
                Stream(n_comps=self.feed_stream_liq.n_comps, name=name))

        # create the mixed stream consisting of the feed stream and the liquid from the tray above the feed tray
        name = self.name + 'MixedLiquidFeed'
        #        self.mixed_liq_feed = Stream(n_comps=N_COMPS, name=name)
        self.mixed_liq_feed = Stream(n_comps=self.feed_stream_liq.n_comps,
                                     name=name)
        self.unit_dict[name] = self.mixed_liq_feed

        # create the mixer needed to mix the liquid feed and the liquid from the tray above the feed tray
        name = self.name + 'FeedMixer'
        self.feed_mixer = Mixer(streams_in=[
            self.feed_stream_liq, self.tray_liq_stream[feed_tray + 1]
        ],
                                streams_out=[self.mixed_liq_feed],
                                name=name)
        self.unit_dict[name] = self.feed_mixer

        # create trays
        self.trays = []
        for i_tray in range(self.n_trays):
            name = self.name + 'Tray' + str(i_tray)
            if i_tray == self.feed_tray:
                self.trays.append(
                    Tray(
                        liq_stream_in=self.mixed_liq_feed,
                        liq_stream_out=self.tray_liq_stream[i_tray],
                        vap_stream_in=self.tray_vap_stream[i_tray - 1],
                        vap_stream_out=self.tray_vap_stream[i_tray],
                        tray_efficiency=1,  # will be updated later
                        pressure=self.pressure,
                        name=name))
            elif i_tray == 0:
                self.trays.append(
                    Tray(
                        liq_stream_in=self.tray_liq_stream[i_tray + 1],
                        liq_stream_out=self.tray_liq_stream[i_tray],
                        vap_stream_in=self.vapor_reboil,
                        vap_stream_out=self.tray_vap_stream[i_tray],
                        tray_efficiency=1,  # will be updated later
                        pressure=self.pressure,
                        name=name))
            elif i_tray == self.n_trays - 1:
                self.trays.append(
                    Tray(
                        liq_stream_in=self.reflux,
                        liq_stream_out=self.tray_liq_stream[i_tray],
                        vap_stream_in=self.tray_vap_stream[i_tray - 1],
                        vap_stream_out=self.tray_vap_stream[i_tray],
                        tray_efficiency=1,  # will be updated later
                        pressure=self.pressure,
                        name=name))
            else:
                self.trays.append(
                    Tray(
                        liq_stream_in=self.tray_liq_stream[i_tray + 1],
                        liq_stream_out=self.tray_liq_stream[i_tray],
                        vap_stream_in=self.tray_vap_stream[i_tray - 1],
                        vap_stream_out=self.tray_vap_stream[i_tray],
                        tray_efficiency=1,  # will be updated later
                        pressure=self.pressure,
                        name=name))

        self.update_tray_efficiency(tray_efficiency)

        for s in self.tray_liq_stream:
            self.unit_dict[s.name] = s

        for s in self.tray_vap_stream:
            self.unit_dict[s.name] = s

        for s in self.trays:
            self.unit_dict[s.name] = s

        name = self.name + 'CondensateConnector'
        self.condensate_connector = Connector(self.condensate,
                                              self.tray_vap_stream[n_trays -
                                                                   1],
                                              name=name)
        self.unit_dict[name] = self.condensate_connector

        name = self.name + 'BottomsConnector'
        self.bottoms_connector = Connector(self.bottoms,
                                           self.tray_liq_stream[0],
                                           name=name)
        self.unit_dict[name] = self.bottoms_connector
示例#12
0
    def __init__(self, master):
        self.master = master
        self.ID = "main"
        #============ Menu ======================

        self.menubar = Menu(master)
        self.filemenu = Menu(self.menubar, tearoff=0)
        self.filemenu.add_command(label="Save")
        self.filemenu.add_command(label="Open")
        self.filemenu.add_command(label="New")
        self.filemenu.add_separator()
        self.filemenu.add_command(label="Audio Settings",
                                  command=self.openConfigSettings)
        self.menubar.add_cascade(label="File", menu=self.filemenu)

        self.master.config(menu=self.menubar)

        # True/False is Editable or Not.
        self.mainSettingsList = [["consFolder", False], ["vowelFolder", False],
                                 ["outFolder", False], ["fred", True],
                                 ["initial frequency", True],
                                 ["xFade Length", True], ["Vowel Pad", True],
                                 ["Splice Point", True],
                                 ["Tuning Bounds", True], ["Pad First", True],
                                 ["Pad Last", True], ["Crossfade First", True],
                                 ["Crossfade Last", True]]

        self.indivSettingsList = [["consFile", True], ["vowelFile", True],
                                  ["initial frequency", True],
                                  ["xFade Length", True], ["InitPad", True],
                                  ["EndPad", True], ["Vowel Pad", True],
                                  ["Splice Point", True],
                                  ["Tuning Bounds", True], ["outFile", True]]
        self.readSettings()
        #============ vars ==================

        #self.toneFolderPath = StringVar()
        #self.attackFolderPath = StringVar()

        #============ frames ================

        self.mainFrame = ttk.Frame(self.master)
        self.mainFrame.grid()

        self.leftWrapper = ttk.Frame(self.mainFrame)
        self.leftWrapper.grid(row=0, column=0, sticky=N)

        self.inFrame = ttk.LabelFrame(self.leftWrapper, text="File Setup")
        self.inFrame.grid(row=0, column=0, sticky=N)

        self.settingsFrame = ttk.LabelFrame(self.mainFrame,
                                            text="Main Settings")
        self.settingsFrame.grid(row=0, column=1)

        self.trayFrame = ttk.LabelFrame(self.leftWrapper, text="Tray")
        self.trayFrame.grid(row=2, column=0, sticky=N + W)

        self.goFrame = ttk.Frame(self.leftWrapper)
        self.goFrame.grid(row=1, column=0, sticky=E + W)

        self.graphicsFrame = ttk.LabelFrame(self.mainFrame, text="Editing")
        self.graphicsFrame.grid(row=0, column=2, sticky=N)

        #============ inFrame ==========================

        self.chooseAttackButton = ttk.Button(
            self.inFrame,
            text="Choose Attack Folder",
            command=lambda: self.chooseFolder("consFolder"))
        self.chooseAttackButton.grid(row=0, column=0)

        self.chooseToneButton = ttk.Button(
            self.inFrame,
            text="Choose Tone Folder",
            command=lambda: self.chooseFolder("vowelFolder"))
        self.chooseToneButton.grid(row=0, column=1)

        self.chooseFred = ttk.Button(self.inFrame,
                                     text="Choose fred",
                                     command=lambda: self.chooseFolder("fred"))
        self.chooseFred.grid(row=0, column=2)

        self.chooseDestinationButton = ttk.Button(
            self.inFrame,
            text="Choose Destination Folder",
            command=lambda: self.chooseFolder("outFolder"))
        self.chooseDestinationButton.grid(row=1,
                                          column=0,
                                          columnspan=2,
                                          sticky=W)

        #============ goFrame =============================

        self.goButton = ttk.Button(self.goFrame,
                                   text="Process Batch",
                                   command=self.spliceByBatch)
        self.goButton.grid(row=0, column=0)

        self.statusLabel = ttk.Label(self.goFrame, text="IDLE")
        self.statusLabel.grid(row=0, column=1)

        #============ settingsFrame =======================

        self.mainSettings = MainSettings(self.settingsFrame,
                                         settings=self.mainSettingsList)
        self.mainSettings.grid(row=0, column=0, sticky=E)

        print "  "
        print "============ SETTINGS IMPORTED FROM json ============="
        self.mainSettings.setValues(self.settings)
        print "============ END OF json IMPORT ============="

        self.applySettingsButton = ttk.Button(self.settingsFrame,
                                              text="Apply",
                                              command=self.applyMainSettings)
        self.applySettingsButton.grid(row=1)

        #============ trayFrame ============================

        self.tray = Tray(
            self.trayFrame,
            settings=self.indivSettingsList)  #,initialSettings=self.settings)
        self.tray.grid()
        #for i in range(11):
        #	self.tray.addItem(json.loads(open('settings.json').read()))

        # self.placeHolder = ttk.Button(self.trayFrame, text="Placeholder",
        # 							  command=self.placeholderButton)
        # self.placeHolder.grid()

        #============ graphicsFrame ============================
        self.graphs = {}

        self.padGraph = Graphic(self.graphicsFrame, self.numFiles, 100,
                                "Padding")
        self.padGraph.grid(row=0, column=0)
        self.graphs["pads"] = self.padGraph

        self.padGraph = Graphic(self.graphicsFrame,
                                self.numFiles,
                                100,
                                "Cross Fade Length",
                                maxRange=800)
        self.padGraph.grid(row=0, column=1)
        self.graphs["cfls"] = self.padGraph
示例#13
0
def start():
    #First, we get the basic information:
    info = config.getBasicInfo()
    MODE = info[0]
    lastTrigger = config.getLastTrigger()

    # Goal : Get basic config, load config, load tray and determine the TIMER
    if MODE == 0:
        EXERCISES_MODE, EXERCISES_SELECTED, NUMBER_TO_PICK_PER_SESSION, TIMER = info[
            1:]
        # Get List EXERCISES Config:
        ListEXERCISES = getListOfEXERCISES(EXERCISES_SELECTED)
        # Start STRAY as THREAD
        tray = Tray(MODE, TIMER, EXERCISES_MODE, EXERCISES_SELECTED)

    elif MODE == 1:
        EXERCISES_MODE, EXERCISES_SELECTED, NUMBER_TO_PICK_PER_SESSION, HOURS, MAXIMUM_NUMBER_OF_SESSIONS_PER_INTERVAL, RECUPERATION_TIME_SECONDS = info[
            1:]
        # Get List EXERCISES Config:
        ListEXERCISES = getListOfEXERCISES(EXERCISES_SELECTED)
        # Start STRAY as THREAD
        tray = Tray(MODE, [
            HOURS, MAXIMUM_NUMBER_OF_SESSIONS_PER_INTERVAL,
            RECUPERATION_TIME_SECONDS
        ], EXERCISES_MODE, EXERCISES_SELECTED)

        # Get current time and hour : determine TIMER

        HOURS.sort()
        expandedIntervals = [[j for j in range(*HOURS[i:i + 2])]
                             for i in range(0, len(HOURS), 2)]
        currentDT = datetime.datetime.now()
        n = 0
        if lastTrigger == None:
            lastTrigger = [0, -1]
            notify(
                "Workout Starter Pack",
                "Error: Couldn't get the last trigger from config. Switching to [0, -1] by default.",
                5)

        for i in range(len(expandedIntervals)):
            expandedInterval = expandedIntervals[i]
            if currentDT.hour in expandedInterval:

                if lastTrigger[
                        0] < MAXIMUM_NUMBER_OF_SESSIONS_PER_INTERVAL and lastTrigger[
                            1] == i:
                    TIMER = RECUPERATION_TIME_SECONDS
                    lastTrigger = [lastTrigger[0] + 1, i]

                elif lastTrigger[1] != i:
                    lastTrigger = [1, i]
                    TIMER = 5

                else:
                    nextHour = HOURS[0]
                    nextDay = datetime.datetime(currentDT.year,
                                                currentDT.month,
                                                currentDT.day + 1).day

                    for i in HOURS[::2]:
                        if i > currentDT.hour:
                            nextHour = i
                            nextDay = currentDT.day

                    nextDateTime = datetime.datetime(currentDT.year,
                                                     currentDT.month, nextDay,
                                                     nextHour, 0)
                    TIMER = (nextDateTime - currentDT).total_seconds()
                    print(
                        "Skipping to next interval because finished this one")
                    # config.updateLastTrigger(0, -1)
            else:
                n += 1

        # Update current interval and interation in config if currentDT not in any interval
        if n == len(expandedIntervals):
            print("Not in any intverval")
            lastTrigger = [0, -1]
            nextHour = HOURS[0]
            nextDay = datetime.datetime(currentDT.year, currentDT.month,
                                        currentDT.day + 1).day

            for i in HOURS[::2]:
                if i >= currentDT.hour:
                    nextHour = i
                    nextDay = currentDT.day

            nextDateTime = datetime.datetime(currentDT.year, currentDT.month,
                                             nextDay, nextHour, 0)
            TIMER = (nextDateTime - currentDT).total_seconds()

    # Notify for the user of what was done
    if len(ListEXERCISES) == 0:
        notify(
            "Workout Starter Pack",
            "Error: no exercises loaded. Please look at the configuration file. Quitting.",
            5)
        sys.exit(0)

    # EXERCISES_MODE :
    if EXERCISES_MODE == 1:
        shuffle(ListEXERCISES)
    ListEXERCISES = ListEXERCISES[:NUMBER_TO_PICK_PER_SESSION]

    # Notify of the next session's content
    names = [i[0] for i in ListEXERCISES]
    notify(
        "Workout Starter Pack",
        str(len(ListEXERCISES)) + " exercise(s) loaded!\nWaiting " +
        str(int(TIMER)) + " seconds. \nNext Session : " + " ".join(names), 5)

    # Starting the tray
    tray.init_icon_tray()

    # Sleep TIMER seconds
    time.sleep(TIMER)

    # Redirect the keys and mouse events
    print("Redirecting keys events...")
    inputs = config.getInputsConfig()
    keyboard = Thread(target=lambda: init_keyboard(*inputs))
    keyboard.start()

    # Run the server
    PORT = config.getServerConfig()
    if (has_internet()):
        notify("Workout Starter Pack",
               ((EXERCISES_MODE == 0) and "Ordered" or "Randomized") +
               " sequence :\n  - " + "\n  - ".join(names), 5)
        run(lastTrigger, ListEXERCISES, PORT, tray)
    else:
        notify(
            "Workout Starter Pack",
            "No internet connection (needed for the webserver)! Stopping...",
            5,
            threaded=False)
示例#14
0
from fetcher import Fetcher
from preferences import Preferences
from tray import Tray

app = QApplication([])

ICON_PATH = f"{path.abspath(path.curdir)}/icon.png"
# Create the icon
icon = QIcon(ICON_PATH)

app.setQuitOnLastWindowClosed(False)

# Create the tray
settings = Preferences()
tray = Tray(icon, settings)
fetcher = Fetcher(settings)
# tray.activated.connect(lambda ev: print(ev))
timer = QTimer()
timer.setSingleShot(False)
timer.setInterval(60 * 1000)


def notify_time(time, delay=None):
    if not delay:
        command = f"notify-send -i {ICON_PATH} '{time}'"
    else:
        command = f"notify-send -i {ICON_PATH} 'Le métro de {time} part dans {delay} minutes'"
    system(command)