Пример #1
0
        def fromevent(self, event):
            # event.state is a pain - it shows the state of the modifiers *before* a modifier key was pressed
            modifiers = ((GetKeyState(VK_MENU) & 0x8000) and MOD_ALT) | ((GetKeyState(VK_CONTROL) & 0x8000) and MOD_CONTROL) | ((GetKeyState(VK_SHIFT) & 0x8000) and MOD_SHIFT) | ((GetKeyState(VK_LWIN) & 0x8000) and MOD_WIN) | ((GetKeyState(VK_RWIN) & 0x8000) and MOD_WIN)
            keycode = event.keycode

            if keycode in [ VK_SHIFT, VK_CONTROL, VK_MENU, VK_LWIN, VK_RWIN ]:
                return (0, modifiers)
            if not modifiers:
                if keycode == VK_ESCAPE:	# Esc = retain previous
                    return False
                elif keycode in [ VK_BACK, VK_DELETE, VK_CLEAR, VK_OEM_CLEAR ]:	# BkSp, Del, Clear = clear hotkey
                    return None
                elif keycode in [ VK_RETURN, VK_SPACE, VK_OEM_MINUS] or 0x41 <= keycode <= 0x5a:	# don't allow keys needed for typing in System Map
                    winsound.MessageBeep()
                    return None
                elif keycode in [ VK_NUMLOCK, VK_SCROLL, VK_PROCESSKEY ] or VK_CAPITAL <= keycode <= VK_MODECHANGE:	# ignore unmodified mode switch keys
                    return (0, modifiers)

            # See if the keycode is usable and available
            if RegisterHotKey(None, 2, modifiers|MOD_NOREPEAT, keycode):
                UnregisterHotKey(None, 2)
                return (keycode, modifiers)
            else:
                winsound.MessageBeep()
                return None
Пример #2
0
def restore_settings():
    """Reset settings

    Called when a user clicks the "Restore Default Settings" button in the Chatbot UI.
    """

    global settings

    winsound.MessageBeep(winsound.MB_ICONEXCLAMATION)
    return_value = ctypes.windll.user32.MessageBoxW(
        0,
        "You are about to restore all settings to their default values. Are you sure you want to continue?",
        "Restore all settings?",
        4
    )

    if return_value == 6:
        settings.reset()
        settings.save()
        winsound.MessageBeep(winsound.MB_ICONEXCLAMATION)
        ctypes.windll.user32.MessageBoxW(
            0,
            "All settings have been restored to their default values. Click away from this script (i.e. click on a "
            "different one) and then click back to this one to refresh the values you see.",
            "Default Settings Restored",
            0
        )
Пример #3
0
    def check_status(self):
        """check if voltage is higher than critical value and change message """
        if self.voltage > self.criticalValue and not self.statusHigh:  #just went high
            self.statusHigh = True
            self.channelMessage = self.channelMessageHigh
            if ss is not None:
                if self.highSoundFile is not None:  #specific high soundfile
                    ss.playFile(os.path.join("sounds", self.highSoundFile), 1,
                                60.0)
                elif self.highIsGood:
                    winsound.MessageBeep(
                        winsound.MB_ICONASTERISK
                    )  #high is good and we just went high so nice sound
                else:
                    winsound.MessageBeep(
                        winsound.MB_ICONHAND
                    )  #high is bad and we just went high so bad sound

        elif self.voltage < self.criticalValue and self.statusHigh:  #just went low
            self.statusHigh = False
            self.channelMessage = self.channelMessageLow
            if ss is not None:
                if self.lowSoundFile is not None:  #specific high soundfile
                    ss.playFile(os.path.join("sounds", self.lowSoundFile), 1,
                                60.0)
                if not self.highIsGood:
                    winsound.MessageBeep(
                        winsound.MB_ICONASTERISK
                    )  #high is bad and we just went low so good sound
                else:
                    winsound.MessageBeep(
                        winsound.MB_ICONHAND
                    )  #high is good and we just went low so bad sound
Пример #4
0
    def show_motor_imagery(self, cue_pos_choices, with_feedback=False):
        self.screen.fill(self.black)
        pygame.display.update()
        time.sleep(3)

        pygame.draw.circle(self.screen, self.green, self.mid_pos, self.radius)
        pygame.display.update()
        time.sleep(1)
        # ensure that each cue pos will be equally chosen
        cue_pos = random.choice(list(cue_pos_choices.keys()))
        cue_pos_choices[cue_pos] -= 1
        if cue_pos_choices[cue_pos] == 0:
            del cue_pos_choices[cue_pos]

        if cue_pos == "left":
            self.screen.blit(self.red_arrow_left, self.red_arrow_left_pos)
            self.record_data_liveEEG.add_trial(1)
        elif cue_pos == "right":
            self.screen.blit(self.red_arrow_right, self.red_arrow_right_pos)
            self.record_data_liveEEG.add_trial(2)
        elif cue_pos == "both":
            self.screen.blit(self.red_arrow_right, self.red_arrow_right_pos)
            self.screen.blit(self.red_arrow_left, self.red_arrow_left_pos)
            self.record_data_liveEEG.add_trial(3)
        pygame.display.update()
        time.sleep(0.5)

        if on_windows:
            #t = time.time()
            winsound.MessageBeep() #winsound.Beep(2500, 500)
            time.sleep(0.5)
            #print(time.time() - t)
            time.sleep(3)
        else:
            self.play_beep()
            time.sleep(3.5)

        self.screen.fill(self.black)
        pygame.display.update()

        if on_windows:
            winsound.MessageBeep() #Beep(2500, 500)
            time.sleep(0.5)
            time.sleep(1.5)
        else:
            self.play_beep()
            time.sleep(2)

        if with_feedback:
            one_or_zero = random.choice([0, 1])
            smiley = [self.sad_smiley, self.happy_smiley][one_or_zero]
            self.record_data_liveEEG.add_feedback(one_or_zero)
            self.screen.blit(smiley, self.smiley_mid_pos)
            pygame.display.update()
            time.sleep(3)

        return cue_pos_choices
Пример #5
0
def download(url,
             ondeSalvar,
             nomeSalvar,
             notificarerro="s",
             notificarsucesso="n"):
    try:
        r2 = requests.head(url)
        total_length = int(r2.headers.get("content-length"))
        r = requests.get(url, stream=True)
        print(f"Tamanho de {nomeSalvar}: {total_length}")
        with open(
                ondeSalvar.replace("'", "") + "\\" + nomeSalvar + ".mp4",
                "wb") as fopen:

            if total_length is None:
                printProgressBar(0, 1000, "Baixando " + nomeSalvar,
                                 " 0 bytes, indefinidamente.", 1, 30, "█")
                fopen.write(r.content)
                printProgressBar(
                    100, 100, "Baixando " + nomeSalvar,
                    str(
                        os.stat(
                            ondeSalvar.replace("'", "") + "\\" + nomeSalvar +
                            ".mp4").st_size) + " bytes, indefinidamente.", 1,
                    30, "█")

            else:
                total_length = int(total_length)
                toftp = printProgressBar(
                    0, total_length, "Baixando " + nomeSalvar,
                    " completados. " + "0" + "/" +
                    int(total_length / 1024).__str__() + " KB", 1, 30, "█")
                for data in r.iter_content(chunk_size=36768):
                    fopen.write(data)
                    print(" " * toftp, end="\r")
                    toftp = printProgressBar(
                        (os.stat(
                            ondeSalvar.replace("'", "") + "\\" + nomeSalvar +
                            ".mp4").st_size), total_length,
                        "Baixando " + nomeSalvar[:17] + "...",
                        " completados. " + str(
                            int(
                                os.stat(
                                    ondeSalvar.replace("'", "") + "\\" +
                                    nomeSalvar + ".mp4").st_size / 1024)) +
                        "/" + int(total_length / 1024).__str__() + " KB", 1,
                        30, "█")
    except Exception as e:
        if (notificarerro == "s" or notificarerro == "S"):
            winsound.MessageBeep(winsound.MB_ICONHAND)
        return e.__str__()
    else:
        if (notificarsucesso == "s" or notificarsucesso == "S"):
            winsound.MessageBeep(winsound.MB_ICONASTERISK)
        return "ok"
Пример #6
0
 def addWatched(self):
     watched = Watched()
     existed = watched.WatchedInsert({'title':self.title})
     if existed:
         self.msg.setText('添加番剧成功')
         winsound.MessageBeep(1000)
         self.msg.show()
     else:
         self.msg.setText('番剧已存在')
         winsound.MessageBeep(1000)
         self.msg.show()
     self.close()
     self.rightclick_show = False
Пример #7
0
 def addFollow(self):
     follow = Follow()
     existed = follow.FollowInsert({'title':self.title})
     if existed:
         self.msg.setText('添加番剧成功')
         winsound.MessageBeep(1000)
         self.msg.show()
     else:
         self.msg.setText('番剧已存在')
         winsound.MessageBeep(1000)
         self.msg.show()
     self.close()
     self.rightclick_show = False
 def deleteFollow(self):
     follow = Follow()
     existed = follow.FollowDelete(self.title)
     if existed:
         self.msg.setText('删除番剧成功')
         winsound.MessageBeep(1000)
         self.msg.show()
     else:
         self.msg.setText('番剧不存在')
         winsound.MessageBeep(1000)
         self.msg.show()
     self.close()
     self.rightclick_show = False
Пример #9
0
 def deleteWatched(self):
     watched = Watched()
     existed = watched.WatchedDelete(self.title)
     if existed:
         self.msg.setText('删除番剧成功')
         winsound.MessageBeep(1000)
         self.msg.show()
     else:
         self.msg.setText('番剧不存在')
         winsound.MessageBeep(1000)
         self.msg.show()
     self.close()
     self.rightclick_show = False
Пример #10
0
def pomodoro_timer(task_time, break_time):
    while app_running:
        sleep(task_time)
        print(f'\n\nTime to work!'
              f'\nTry to focus on your task for {task_time} minutes.'
              f'\nYour computer will sound when is time to take a break.')
        winsound.MessageBeep(frequency)

        sleep(break_time)
        print(
            f'\n\nIt is break time!'
            f'\nYou have {break_time} minutes to do something not related to the task.'
            f'\nYour computer will make a sound when the break is over.')
        winsound.MessageBeep(frequency)
Пример #11
0
    def run(self):
        runs = 0
        total_accuracy = 0

        results = []

        for l in self.languages:
            actual_accuracy = 0
            for r in range(self.runs):
                accuracy = self._run_once(l)
                total_accuracy += accuracy
                actual_accuracy += accuracy
                runs += 1
            results.append((l, actual_accuracy / self.runs))
            print("")

        print("----")

        for l, v in results:
            print("%s ==> %.2f %%" % (l, 100 * v))

        finale = "----\nTOTAL: %.2f %% accuracy achieved with %s" % (
            (100 * total_accuracy / runs), self.alice)
        print(finale)

        winsound.MessageBeep()
        return (results, self.tests, finale)
Пример #12
0
def sound():

    for i in range(2):

        for j in range(10):

            winsound.MessageBeep()
Пример #13
0
def main():
    soup = getServerNodeListSoup(True)
    # each <tr> row meaing one server
    tr_servers = soup.select("#speedtest_v4 tr")
    # get the server node info form <tr>
    for one_tr in tr_servers:
        tds = one_tr.find_all("td")
        try:
            name = tds[0].get_text().strip()
            address = ""
            if tds[1].a is not None:
                # the second <td> is server node's url
                address = tds[1].a['href']
                vultrServerNodes.append(Node(name, address))
                vultrServersScore[vultrServerNodes[-1]] = Result()
        except TypeError as e:
            print("catch a TypeError,maybe server {0} will coming soon.")
            print(e)
            pass

    ping_count = 64
    client_ping(vultrServerNodes, ping_count, vultrServersScore)
    server_ping(vultrServerNodes, publicIP(), ping_count, vultrServersScore)
    servers_download(vultrServerNodes, vultrServersScore)
    print_as_table(vultrServersScore)
    write_to_csv(vultrServersScore)
    winsound.MessageBeep(winsound.MB_OK)
    def start(self):
        target = self.select_target()
        sessions_amount = self.get_number_of_samples_per_session()
        duration_s = sessions_amount * c.USER_TRAINING_DURATION_S
        print "Please concentrate on the '" + target + "' for " + str(
            duration_s) + "s :"
        exercise = MathQuizGenerator().generate()

        window = self.draw_fix_cross(target + ": " + str(duration_s) + "s",
                                     exercise)
        time.sleep(2)
        packet_queue = Queue()
        process = Process(target=emotiv_start_reader, args=(packet_queue, ))
        process.start()
        raw_data = Sampler(packet_queue).get_samples(duration_s)
        process.terminate()
        window.close()
        winsound.MessageBeep()
        samples = []
        chunk_size = len(raw_data) / sessions_amount
        for i in range(sessions_amount):
            chunk = raw_data[(chunk_size * i):(chunk_size * i + chunk_size)]
            freq_domains = RawDataTransformer(chunk).transform()
            windows_number = len(freq_domains.values()[0])

            for w in range(windows_number):
                sample = [target]
                for sensor in freq_domains:
                    sample += freq_domains[sensor][w]
                samples.append(sample)

        self.process_prediction_data(samples)
Пример #15
0
 def processing_new(self):
     try:
         self.loader.close()
     except:
         True
     self.setWindowTitle(self.list_filename[0])
     self.save_file.setEnabled(True)
     self.save_roi.setEnabled(True)
     self.popup_()
     self.list_mode_processor=List_Mode()
     s=time.time()
     self.sync_time,sync_channel=Conversion.convert(self.sync_filename[0])
     del sync_channel
     self.list_time,self.list_channel=Conversion.convert(self.list_filename[0])
     
     print('Imported and conveted in {:.2f}s'.format(time.time()-s))
     winsound.MessageBeep()
     delt=(self.sync_time[2]-self.sync_time[1])
     #set the maximum value for the end time and start times
     maxe=int((self.list_time[-1]-self.list_time[0])*1e-6)
     self.end_time.setMaximum(maxe)
     self.end_time.setValue(maxe)
     self.start_time.setMaximum(maxe-1)
     self.start_time.setValue(0)
     self.offset.setMaximum(int(delt-self.duty_cycle.value()/100*delt))
     self.offset.setMinimum(int(-(delt*self.duty_cycle.value()/100)*.5))
     self.view_pop.setEnabled(True)
     self.updater()
Пример #16
0
 def OnKeyUp(self, evt: wx.KeyEvent):
     if not self.dictating:
         evt.Skip(True)
         return
     if evt.GetKeyCode() in [8]:
         evt.Skip(True)
     else:
         evt.Skip(False)
         text = self.rtext.GetValue()
         actual_char = chr(evt.GetUnicodeKey())
         expected_char = self.dictation_text[len(text)]
         if actual_char == expected_char:
             self.rtext.EndUnderline()
             self.rtext.WriteText(actual_char)
             try:
                 expected_char = self.dictation_text[len(text) + 1]
                 if expected_char in ';.,:!?" ':
                     self.say_next_word()
             except:
                 pass
         else:
             self.rtext.BeginUnderline()
             self.rtext.BeginTextColour(wx.Colour(255, 0, 0, 255))
             self.rtext.WriteText(actual_char)
             self.rtext.EndTextColour()
             self.rtext.EndUnderline()
             winsound.MessageBeep(500)
Пример #17
0
    def __startListen(self, coor, routeId, stationName, checkDelay, dayList,
                      startTime, endTime, deviation):
        """
        Use threading to start a checker.
        """
        while 1:
            if dayList:
                if not self.checkDay(dayList):
                    return False

            if startTime and endTime:
                if not self.checkCurrentTimeInRange(startTime, endTime):
                    time.sleep(2)
                    continue

            position = self.spyder.getRefuse_Trucks_Position(routeId)

            if position:
                result = self.checkCoordinateInRange(coor, position, deviation)

                if result:
                    winsound.MessageBeep(20)
                    ctypes.windll.user32.MessageBoxW(
                        0, f'垃圾車已到達: {stationName} 此站點', '垃圾車到點通知', 0x1000)
                    return True
            time.sleep(checkDelay)
Пример #18
0
def search_files(root_dir=None, key_word=None):
    if root_dir is None:
        root_dir = easygui.diropenbox()
    if root_dir is None:
        return None
    if key_word is None:
        key_word = easygui.enterbox("Enter search keyword:")
    if key_word is None:
        return None
    else:
        key_word = key_word.upper()

    found_files = []
    searched_files = 0
    file_tree = os.walk(root_dir)
    for path in file_tree:
        for file_name in path[2]:
            searched_files += 1
            if key_word in file_name.upper():
                found_files.append(os.path.join(path[0], file_name))
            else:
                pass
            if searched_files % 5000 == 0:
                print("Searched {} files...".format(searched_files))
    winsound.MessageBeep()
    return found_files
Пример #19
0
 def pick(control):
     repeatCount = scriptHandler.getLastScriptRepeatCount()
     oldTimes = {
         x: self.getTime(self._getByVersion(x))
         for x in {control, 'start', 'end', 'length'}
     }
     gesture.send()
     newTimes = {
         x: self.getTime(self._getByVersion(x))
         for x in {control, 'start', 'end', 'length'}
     }
     if newTimes == oldTimes:
         winsound.MessageBeep()
     else:
         newTimes['audio'] = self.getTime(self._getByVersion('audio'))
         message = newTimes[
             control] + ' selected' if control == 'length' else newTimes[
                 control]
         if repeatCount == 0:
             if self.outBox and self.outBox.running:
                 for pending in self.outBox._CallLater__RUNNING - set(
                     (self.outBox, )):
                     pending.Stop()
             else:
                 ui.message(message)
         else:
             self.outBox.Restart(60, message)
Пример #20
0
def beep():
    """Tells the computer to make a "beep" sound."""
    import os
    import sys

    platforms = {
        'linux1': 'Linux',
        'linux2': 'Linux',
        'darwin': 'OS X',
        'win32': 'Windows',
    }

    if sys.platform in platforms:
        if platforms[sys.platform] == 'Windows':
            try:
                import winsound
                winsound.MessageBeep()
            except ImportError:
                print('Beep!')
        elif platforms[sys.platform] == 'OS X':
            # os.system("echo -ne '\007'")
            os.system('say "beep"')
        elif platforms[sys.platform] == 'Linux':
            os.system('beep')
    else:
        print('Beep!')
Пример #21
0
 def on_release(self, key):
     '''
     Funktsioon arvutiga ühendatud seadmega suhtlemiseks:
     'F12' klahvi peale arvuti küsib seadmelt käsuga (kirjutatud vastavasse lahtrisse) andmed ja edastab aktiivsele aknale
     
     '''
     global shell
     try: k = key.char # single-char keys
     except: k = key.name # other keys
     if key == keyboard.Key.esc: return False # stop listener
     if k in ['f9']: # keys interested
         if self.checkButtonOutput.get():
             for case in switch(self.valitud_output_parameter.get()):
                 if case('Kiirus'):
                     shell.SendKeys(self.kiirus.get()+'~')
                     break
                 if case('Pikkus'):
                     shell.SendKeys(self.pikkus.get()+'~')
                     break
                 if case('Sagedus'):
                     shell.SendKeys(self.sagedus.get()+'~')
                     break
                 if case('Pikkus //t kiirus'):
                     shell.SendKeys(self.pikkus.get()+"\t"+self.kiirus.get()+'~')
                     break
                 if case('Kirje'):
                     shell.SendKeys(self.statusText.get()+'~')
                     break
                 if case(): # default, could also just omit condition or 'if True'
                     shell.SendKeys('\t'.join((self.statusText.get()).split(" "))+'~')
                     break
             winsound.MessageBeep()  
Пример #22
0
    def equals_to(self, event=None):
        '''Calculate the given equation'''

        value = self.var.get().replace('%', '/100').replace('÷', '/')

        try:
            if self.count_operators(value):
                get = self.var.get()
                answer = str(eval(value))

                if '.' in answer:  # if answer contains '.' (decimal)
                    split = answer.split('.')

                    if int(
                            split[1]
                    ) == 0:  # Removing .0 when the value in answer after '.' (decimal) is all '0'
                        self.var.set(split[0])
                        hist = f'{get} = {split[0]}\n'
                        self.decimal_placeable = True

                    else:  # If value in answer after '.'(decimal) is not all '0'
                        self.var.set(answer)
                        hist = f'{get} = {answer}\n'
                        self.decimal_placeable = False

                else:  # if answer does not contain '.' (decimal)
                    self.var.set(answer)
                    hist = f'{get} = {answer}\n'
                    self.decimal_placeable = True

                self.history(hist)

        except ZeroDivisionError:  # This error is caused if any number is divided by "0"
            winsound.MessageBeep()
            self.var.set('Cannot divide by ZERO')
Пример #23
0
def listen(addr='127.0.0.1', port='99'):
    sv = socket(AF_INET, SOCK_STREAM)
    sv.bind((addr, port))
    sv.listen(5)
    addtext("Started Listening")
    while True:
        c, addr = sv.accept()
        addtext("Connection Recieved From" + str(addr))
        while True:
            try:
                resp = bytes.decode(c.recv(1024))
            except:
                addtext("CONNECTION TO " + addr[0] + " FORCIBLY CLOSED")
                break
            addtext(resp)
            name_len = len(resp.split(":", 1)[0])
            row_number = int(txtField.index('end-1c').split('.')[0]) - 1
            txtField.tag_add("remote_name",
                             str(row_number) + ".0",
                             str(row_number) + "." + str(name_len))
            root.state('normal')
            winsound.MessageBeep()
            txtField.see('end')
            if resp == 'dc.disconnect()':
                c.send(
                    str.encode("(DISCONNECT REGISTERED. CLOSING CONNECTION)"))
                c.close()
                break
Пример #24
0
def copyClip():
    global listT
    while True:
            

            
            try:
                if keyboard.is_pressed('ctrl+c'):
                    print("pressed")

                    var=copy_clipboard()
                    listT.append(var)
                    if len(listT)==8:
                        winsound.MessageBeep()
                    if len(listT)==11:
                        print("1"+""+str(listT[0]))

                        print("3"+""+str(listT[2]))

                        print("5"+""+str(listT[4]))
                        print("7"+""+str(listT[6]))
                        print("9"+""+str(listT[8]))
                        
                        listT.clear()
                        #print(len(listT))
                        var=copy_clipboard()
                        listT.append(var)
                if keyboard.is_pressed('='):
                    listT.clear()
               
            except:
                  print("error")
def scheduled_job():
    print('This job is run every weekday at 7am.')
    firebase_config()
    crawl_corona()
    # to_spark()
    print(datetime.datetime.now())
    winsound.MessageBeep(winsound.MB_OK)
Пример #26
0
 def CheckAlertBalloons(self):
     charge = self.batt_mon.percentage_charge_remaining
     if self.batt_mon.should_unplug():
         self.ShowBalloon(
             "Unplug charger",
             "Battery charge is at %i%%. Unplug your charger now to maintain battery life."
             % (charge * 100))
         logger.info("Showing unplug balloon notification")
         winsound.MessageBeep(winsound.MB_ICONASTERISK)
     if self.batt_mon.should_plug_in():
         self.ShowBalloon(
             "Plug in charger",
             "Battery charge is at %i%%. Plug in your charger now to maintain battery life."
             % (charge * 100))
         logger.info("Showing plug in balloon notification")
         winsound.MessageBeep(winsound.MB_ICONASTERISK)
Пример #27
0
    def __init__(self, text, *args, **kwargs):
        wx.Dialog.__init__(self, *args, **kwargs)

        self.add_sku = False
        winsound.MessageBeep(winsound.MB_OK)

        main_sizer = wx.BoxSizer(wx.VERTICAL)

        title = Text(self, label=text)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        no_button = wx.Button(self, label="NO (-)")
        yes_button = wx.Button(self, label="YES (+)")

        main_sizer.Add(title, 0, wx.ALL, 50)
        main_sizer.Add(buttons_sizer, 0, wx.EXPAND | wx.HORIZONTAL | wx.ALL,
                       50)
        buttons_sizer.Add(no_button, 0)
        buttons_sizer.Add(yes_button, 0)

        yes_button.Bind(wx.EVT_BUTTON, lambda x: self.setAddSku(True))
        no_button.Bind(wx.EVT_BUTTON, lambda x: self.setAddSku(False))
        self.Bind(wx.EVT_CHAR_HOOK, self.handleKeys)

        no_button.SetFont(DEFAULTFONT)
        yes_button.SetFont(DEFAULTFONT)

        self.SetSizerAndFit(main_sizer)
        self.Layout()
        self.ShowModal()
Пример #28
0
    def run(self):
        while self.fd.is_alive():
            time.sleep(1)

        winsound.MessageBeep()
        self.text.setText('Done')
        self.btn.setDisabled(False)
        self.resbtn.setDisabled(False)
    def UpdateDisplay(self):
        [self.azmVal, self.altVal] = self.mnt.GetAzmAlt()

        if 295 < self.azmVal or self.azmVal < 45.0:
            self.AzmDisplay.UpdateForegroundColor('black')
        else:
            self.AzmDisplay.UpdateForegroundColor('red')
            winsound.MessageBeep()

        if 330 < self.altVal or self.altVal < 30:
            self.AltDisplay.UpdateForegroundColor('black')
        else:
            self.AltDisplay.UpdateForegroundColor('red')
            winsound.MessageBeep()

        self.AzmDisplay.UpdateText('', self.azmVal, '%(#1)1.2f')
        self.AltDisplay.UpdateText('', self.altVal, '%(#1)1.2f')
Пример #30
0
def SetDefaults():
    global MySettings

    winsound.MessageBeep()
    response = MessageBox(0, u"You are about to reset the settings to their default values, are you sure you want to continue?", u"Reset settings file?", 4)
    if response == MessageBoxYesResponse:
        MySettings.LoadDefaults(True)
        MessageBox(0, u"Settings successfully restored to default values", u"Reset complete!", 0)