예제 #1
0
def operator_query_passfail(TESTNAME):
    d = Dialog(dialog="dialog")

    d.set_background_title("Testing: " + TESTNAME)

    testquery = d.yesno("Was the voltage inverting the probe the same?", width=60, yes_label="Yes, it was", no_label="No, It wasn't")

    # The user pressed cancel
    if testquery is not "ok":
        d.msgbox("Test Fallito.")
        return False
    else: #the user pressed ok
        return True
예제 #2
0
def operator_query_instructions(TESTNAME):
    d = Dialog(dialog="dialog")

    d.set_background_title("Testing: " + TESTNAME)

    testquery = d.msgbox("Check that inverting the gaussmeter you get the same abs value of voltage", width=60)

    # The user pressed cancel
    if testquery is not "ok":
        d.msgbox("Test Interrotto")
        return False
    else: #the user pressed ok
        return True
예제 #3
0
def operator_query_instructions(TESTNAME):
    d = Dialog(dialog="dialog")

    d.set_background_title("Testing: " + TESTNAME)

    testquery = d.msgbox("Please put the sample into the magnetic field in a stable position", width=60)

    # The user pressed cancel
    if testquery is not "ok":
        d.msgbox("Test Interrotto")
        return False
    else: #the user pressed ok
        return True
예제 #4
0
 def __use_defaults(self):
     """
     Use the default preferences file.
     """
     app.debug_print("Using default preferences")
     # show preferences
     prefDiag = Dialog(None, self, initial=True)
     prefDiag.ShowModal()
     try:
         prefDiag.Destroy()
     except wx._core.PyDeadObjectError:
         app.debug_print("=======================")
         pass
예제 #5
0
    def show_dialog(headline, choices, stop=False):
        """Show the dialog and process response."""
        d = Dialog(dialog="dialog")

        logger.debug("Showing Dialog: {0}".format(headline))

        code, tag = d.menu(headline, title="ProtonVPN-CLI", choices=choices)
        if code == "ok":
            return tag
        else:
            os.system("clear")
            print("Canceled.")
            sys.exit(1)
예제 #6
0
def test_procedure(TESTNAME,testDict):
    d = Dialog(dialog="dialog")

    d.set_background_title("Testing: " + TESTNAME)

    if not operator_query_instructions(TESTNAME):
        return False
    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0,0x0c9b)
    except Exception:
        d.msgbox("Data-chan initialization failed")
        return False


    # Start Measuring
    ht.enable(scan)
    ht.set_channel_gain(scan, 5, 5)

    # Set CC gen
    ht.set_current_fixed(scan, 0.3)

    win = pg.GraphicsWindow()
    win.setWindowTitle(TESTNAME)
    meas = {"ch5":{}}
    meas["ch5"]["name"] = "Hall voltage (unamplified)"
    for key in meas:
        meas[key]["plotobj"] = win.addPlot(title=meas[key]["name"])
        meas[key]["data"] = [0]*100
        meas[key]["curveobj"] = meas[key]["plotobj"].plot(meas[key]["data"])

    def update():
        popped_meas = ht.pop_measure(scan)
        if popped_meas is not None:
            for key in meas:
                meas[key]["data"][:-1] = meas[key]["data"][1:]
                meas[key]["data"][-1] = popped_meas[key]
                meas[key]["curveobj"].setData(meas[key]["data"])

    timer = pg.QtCore.QTimer()
    timer.timeout.connect(update)
    timer.start(50)

    ## Start Qt event loop unless running in interactive mode or using pyside.
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
    ht.disconnect_device(scan)
    ht.deinit()
    return operator_query_passfail(TESTNAME)
예제 #7
0
def test_procedure(TESTNAME,testDict):

    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)

    d.msgbox("Connect the heater and press OK")

    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0, 0x0c9b)
    except DataChanDeviceNotFoundOrInaccessibleError:
        d.msgbox("Data-chan initialization failed")
        return False

    # Start Measuring
    ht.enable(scan)
    #ht.set_channel_gain(scan, 2, 1)
    #ht.set_current_fixed(scan, 0.05)

    ht.set_heater_state(scan, 255)
    #ht.set_channel_gain(scan, 2, 1)

    d.gauge_start("Acquiring temperature over Time (with heater on)")

    measures = {}
    # count from 0 to the total number of steps
    for i in range(samples_count):
        time.sleep(sleep)

        # pop all old measures
        while(ht.pop_measure(scan) != None):
            pass
        time.sleep(0.150)
        measures[i] = ht.pop_measure(scan)
        if measures[i] is not None:
            measures[i]["i"] = i * sleep

        d.gauge_update(int(float(i) / samples_count * 100.0))

    d.gauge_stop()
    print(measures)
    ht.disconnect_device(scan)
    ht.deinit()
    testResult = compute.compute(testDict["asset_path"],measures,'i','ch2')
    if(not testResult):
        return False
    if(not (testResult['coeff']['slope']>=0.0005)):
        return False
    return testResult
def pluginmenu():
		choices = []
		d = Dialog()
		#append installed plugins to list
		for key in installed.sections():
			choices.append((key, installed[key]["summary"]))
		if len(choices) == 0:
			choices.append(("No Installed Plugins", ""))
		else:
			#display all installed plugins
			d.add_persistent_args(["--ok-label", "View Page"])
		x = d.menu("Installed Plugins", choices=choices, cancel_label="Back")
		if x[0] == d.OK and x[1] != "No Installed Plugins":
			pluginpage(x[1])
예제 #9
0
 def new_dialog(user):
     return Dialog(pipe,
                   StatisticalNLUModel(
                       slots,
                       SentenceClassifier(
                           BASE_CLF_INTENT,
                           model_path=os.path.join(
                               models_path, "IntentClassifier.model"),
                           model_name="IntentClassifier.model"),
                       name_parser),
                   GraphBasedSberdemoPolicy(data, slots, sayer),
                   user,
                   debug=debug,
                   patience=2)
예제 #10
0
파일: game.py 프로젝트: maksimvrs/SawGame
	def __init__(self):
		self.scroll = 0

		self.player = Player(WIN_WIDTH / 2, 360)

		self.items = [Chest(WIN_WIDTH / 2 + 540, 310, 'images/case.png', "Сейф 1", 320 // 4, 240 // 3),
					  Picture(WIN_WIDTH / 2 - 150, 240, 'images/picture.png', "Картина", 320 // 4, 240 // 3),
					  Books(WIN_WIDTH / 2 + 200, 300, 'images/books.png', "Книги",320 // 2, 240 // 2),
					  Jail(WIN_WIDTH / 2 + 750, 269, 'images/jail.png', "Заключенный", 320, 240),
					  Table(WIN_WIDTH / 2 - 300, 300, 'images/table.png', "Стол", 320 // 2, 240 // 2)]

		self.dialog = Dialog("- Добро пожаловать в мир твоих самых страшных кошмаров, жалкий офисный червяк.")

		self.left = self.right = self.up = self.down = False
예제 #11
0
def prolog():
    result = cur.execute(
        """SELECT * FROM text WHERE location = 1""").fetchall()
    screen.fill([245, 245, 220])
    screen.blit(menu2.image, menu2.rect)
    unNoDialog = Dialog(screen)
    unNoDialog.message = (
        "Это был самый обычный день из моей жизни, как....", )
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = ("???:Приветствую,житель Земли..", )
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = (
        "ЭТО ПОХОДУ РЕАЛЬНО ЧТО-ТО СЕРЬЁЗНОЕ! НАДО КОМУ-НИБУДЬ ПОЗВОНИТЬ.... эээ... Иллуми? Ты звонил Иллуми?Я думаю, что Леорио прав. Я вам ещё чем-то могу помочь или вы дадите мне насладиться моим прекрасным напитком?",
    )
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = ("Элис:Сейчас я готова пообщаться, а ты?.", )
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = ("Элис:Ой, и совсем забыла спросить твоё имя..", )
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = ("Тебе интересно мое имя? Меня зовут Николас.", )
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = ("Элис:Привет Николас, рада познакомиться, а ты?.", )
    unNoDialog.show = True
    unNoDialog.sndNext()
    slot3 = Button.Button()
    slot3.create_button(screen, (90, 255, 100), 40, 300, 200, 50, 0, '3 save',
                        (68, 45, 37))

    slot4 = Button.Button()
    slot4.create_button(screen, (90, 255, 100), 40, 400, 200, 50, 0, '4 save',
                        (68, 45, 37))
    while True:
        pygame.event.pump()
        pygame.display.flip()
        for event in pygame.event.get():
            if event.type == pygame.MOUSEBUTTONDOWN:
                if slot3.pressed(pygame.mouse.get_pos()):
                    print("Концовка-1")
                    click.play()
                    whot()
                elif slot4.pressed(pygame.mouse.get_pos()):
                    print("Продолжение...")
                    click.play()
                    go()
예제 #12
0
def tela():
    d = Dialog() 
    code, ip = d.inputbox("Informe o Endereço IP de destino", height=10, width=45,title="Enviando Dados Cifrados por ICMP")
    while True:
        if check(ip):
            d.infobox("Parabens")
            break
        else:
            code, ip = d.inputbox("Endereço IP Invalido, favor informar um IP de destino válido", height=10, width=45,title="Enviando Dados Cifrados por ICMP")
    code, msg = d.inputbox("Informe a mensagem que deseja cifrar", height=10, width=45,title="Enviando Dados Cifrados por ICMP")
    with io.StringIO() as buf, redirect_stdout(buf):
        ipi.remote_test(ip,msg)
        output = buf.getvalue()
    d.infobox(output,title="Resultado do Ping ",height=14,width=45)
예제 #13
0
def test_procedure(TESTNAME, testDict):
    ####### CONFIG
    measures_to_take = 100
    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)
    d.msgbox("Disconnetti la schedina che fa click-click-click")

    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0, 0x0c9b)
    except Exception:
        d.msgbox("Data-chan initialization failed")
        return False

    # Start Measuring
    ht.enable(scan)
    ht.set_channel_gain(scan, 3, 5)

    d.gauge_start("Acquiring DAC Voltage VS Current measures")

    measures = {}
    raw_current_codes = range(int(4095 / 2 - measures_to_take),
                              int(4095 / 2 + measures_to_take))
    # count from 0 to the total number of steps
    for i in range(len(raw_current_codes)):

        ht.set_current_raw(scan, raw_current_codes[i])
        #pop all old measures
        while (ht.pop_measure(scan) != None):
            pass
        time.sleep(0.150)
        measures[i] = ht.pop_measure(scan)
        d.gauge_update(int(float(i) / float(len(raw_current_codes)) * 100.0))
        if measures[i] is not None:
            measures[i]["raw_current_code"] = raw_current_codes[i]

    d.gauge_stop()

    ht.disconnect_device(scan)
    ht.deinit()
    testResult = compute.compute(testDict["asset_path"], measures,
                                 'raw_current_code', 'ch3')
    if (not testResult):
        return False
    if (not (0.0009 -
             (0.0009 * 0.2) <= testResult['coeff']['slope'] <= 0.0009 +
             (0.0009 * 0.2))):
        return False
    return testResult
def reloadPluginList():
	try:
		file_name = config["paths"]["userPath"] + "/.pluginstore/index.ini"
		link = "https://turbowafflz.azurewebsites.net/iicalc/plugins/index"
		#display progress box of updating index
		d = Dialog(dialog="dialog")
		d.add_persistent_args(["--title", "Updating package List..."])
		d.gauge_start(text="This may take a while if the server hasn\'t been pinged in a while", height=None, width=None, percent=0)

		#download actual index from site
		with open(file_name, "wb") as f:
			try:
				response = requests.get(link, stream=True)
			except requests.exceptions.ConnectionError:
				d.gauge_stop()
				if d.yesno("No Connection. Would you like to continue without a connection?") == d.OK:
					store(False)
				else:
					raise ValueError("Exited")
			total_length = response.headers.get('content-length')

			if total_length is None: # no content length header
				f.write(response.content)
			else:
				dl = 0
				total_length = int(total_length)
				olddone=0
				for data in response.iter_content(chunk_size=4096):
					dl += len(data)
					f.write(data)
					done = int(100 * dl / total_length)
					if done > 100:
						done = 100
					if olddone != done:
						olddone = done

						d.gauge_update(done)
		d.gauge_stop()
		return True
	except KeyboardInterrupt:
		try:
			#Stop gague if it's started
			d.gauge_stop()
		except:
			pass
		with open(config["paths"]["userPath"] + "/.pluginstore/index.ini") as index:
			if index.read().strip("\n") == "#" or index.read().strip("\n") == "":
				return False
			else:
				return True
예제 #15
0
 def choose_cols(self):
     # XX possibility un/check all
     chosens = [(str(i + 1), str(f), f.is_chosen)
                for i, f in enumerate(self.parser.fields)]
     d = Dialog(autowidgetsize=True)
     ret, values = d.checklist(
         "What fields should be included in the output file?",
         choices=chosens)
     if ret == "ok":
         for f in self.parser.fields:
             f.is_chosen = False
         for v in values:
             self.parser.fields[int(v) - 1].is_chosen = True
         self.parser.is_processable = True
예제 #16
0
def kazino_2():
    result = cur.execute("""SELECT replik FROM text WHERE location = 10""").fetchall()
    start = True
    screen.fill([255, 255, 255])
    screen.blit(fon6.image, fon6.rect)
    unNoDialog = Dialog(screen)

    for elem in result:
        phrase = elem[0]
        c = 85
        name = cur.execute(f"""SELECT hero_name FROM heroes WHERE hero_id =
                                (SELECT pers FROM text WHERE replik = ("{phrase}") AND location = 10)""").fetchall()
        name = name[0]
        if len(phrase) > c:
            while phrase[:c][-1] != ' ':
                c -= 1
            first = str(name[0]) + ': ' + phrase[:c]
            unNoDialog.message = (first,
                                  phrase[c:],)
            unNoDialog.show = True
            unNoDialog.sndNext()
        else:
            first = str(name[0]) + ': ' + phrase[:c]
            unNoDialog.message = (first,)
            unNoDialog.show = True
            unNoDialog.sndNext()
    askHelp1 = Button.Button()
    askHelp1.create_button(screen, (124, 124, 124), 0, 500, 900 // 3, 200, 0, 'попросить помощь', (255, 255, 255), 1)
    askKameras1 = Button.Button()
    askKameras1.create_button(screen, (124, 124, 124), 900 // 3, 500, 900 // 3, 200, 0, 'запись с камер',
                              (255, 255, 255), 1)
    nothing1 = Button.Button()
    nothing1.create_button(screen, (124, 124, 124), 900 // 3 * 2, 500, 900 // 3, 200, 0, 'ничего не просить',
                           (255, 255, 255), 1)
    while start:
        pygame.display.update()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
            elif event.type == pygame.MOUSEBUTTONDOWN:
                pos = pygame.mouse.get_pos()
                if askHelp1.pressed(pos):
                    start = False
                    askHelp()
                if askKameras1.pressed(pos):
                    start = False
                    askKameras()
                if nothing1.pressed(pos):
                    start = False
                    nothing()
예제 #17
0
def test_procedure(TESTNAME,testDict):
    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)

    if not operator_query_instructions(TESTNAME):
        return False


    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0,0x0c9b)
    except Exception:
        d.msgbox("Data-chan initialization failed")
        return False

    # Start Measuring
    ht.enable(scan)
    ht.set_channel_gain(scan, 3, 5)
    d.gauge_start("Acquiring DAC Voltage VS Hall Vr measures")


    measures = {}
    raw_current_codes = range (int(2000), int(2100))

    # count from 0 to the total number of steps
    for i in range(len(raw_current_codes)):

        ht.set_current_raw(scan,raw_current_codes[i])
        #pop all old measures
        while(ht.pop_measure(scan) != None ):
            pass
        time.sleep(0.150)
        measures[i] = ht.pop_measure(scan)

        d.gauge_update(int(float(i) / float(len(raw_current_codes)) * 100.0))

        if measures[i] is not None:
            measures[i]["raw_current_code"] = raw_current_codes[i]

    d.gauge_stop()

    ht.disconnect_device(scan)
    ht.deinit()
    testResult = compute.compute(testDict["asset_path"],measures,'raw_current_code','ch6')
    if(not testResult):
        return False
    if(not (-0.0014-(-0.0014*0.2)<=testResult['coeff']['slope']<=-0.0014+(-0.0014*0.2))):
        return False
    return testResult
예제 #18
0
    def __init__(self):
        locale.setlocale(locale.LC_ALL, '')
        print('lala')
        self.game_backend = backend.Backend()
        self.game_dialog = Dialog(dialog='dialog')

        user_input = []
        for i in range(0, self.game_backend.code_length):
            user_input.append([
                self.get_input(i, user_input, True),
                self.get_input(i, user_input, False)
            ])

        print(user_input)
예제 #19
0
def operator_query_instructions(TESTNAME):
    d = Dialog(dialog="dialog")

    d.set_background_title("Testing: " + TESTNAME)

    testquery = d.msgbox(
        "Check that the Hall voltage reponds correctly with the magnetic field by moving the magnet screw",
        width=60)

    # The user pressed cancel
    if testquery is not "ok":
        d.msgbox("Test Interrotto")
        return False
    else:  #the user pressed ok
        return True
예제 #20
0
def board_noise_thresh_scan_report(board_name,**kwargs):

  ### if you want to display the dummy baseline calib
  ### use board_baseline_report(board_name,dummy_calib=True)

  dummy_calib = kwargs.get("dummy_calib",False)

  d = Dialog(dialog="dialog")

  report = gen_noise_thresh_scan_report(board_name,**kwargs)

  if report: 
    code_21, text_21 = dialog_editbox(report)  
  else:
    d.msgbox("no thresh scan info, not scanned")
예제 #21
0
def inteligence():
    objectConversations = request.get_json()
    conversation = Conversation()
    for objectConversation in objectConversations['objectConversations']:
        intention = Intention()

        questions = tuple(objectConversation['questions'])
        responses = tuple(objectConversation['responses'])
        dialog = Dialog(questions, responses, objectConversation['action'])
        intention.insert_dialog(dialog)

        conversation.insert_intention(intention)

    return conversation.get_response(objectConversations['question'],
                                     objectConversations['no_responses'])
예제 #22
0
 def __init__(self, *args):
     try:
         from dialog import Dialog
     except ImportError:
         print("Require 'pythondialog': Install with 'slpkg -s sbo "
               "python2-pythondialog'")
         raise SystemExit()
     self.d = Dialog(dialog="dialog", autowidgetsize=True)
     self.data = args[0]
     self.text = args[1]
     self.title = args[2]
     self.backtitle = args[3]
     self.status = args[4]
     self.ununicode = []
     self.tags = []
예제 #23
0
파일: menu.py 프로젝트: zyioump/o2v
    def __init__(self):
        self.d = Dialog(dialog="dialog")
        self.d.set_background_title(config["GENERAL"]["carName"])

        self.code = self.d.OK

        if config["MOTOR"]["motorEnabled"] == "True":
            self.motor = Motor(config)

        if config["FAN"]["fanEnabled"] == "True":
            self.fan = Fan(config)

        if config["CAMERA"]["cameraEnabled"] == "True":
            self.camera = Camera(config)
            self.camera.start()
예제 #24
0
def dialog_ana_menu():
    d = Dialog(dialog="dialog")
    d.set_background_title("analysis macros")

    gas_options = conf.get_gas_options()

    choices = []

    for entry in conf.list_dir("./ana", ext=".sh"):
        choices += [(entry, "")]
    for entry in conf.list_dir("./ana", ext=".py"):
        choices += [(entry, "")]

    if len(choices):
        code, tag = d.menu("select macro to run", choices=choices)
        return (code, tag)
예제 #25
0
    def start_debug_section():

        d = Dialog(dialog="dialog")
        #d.set_background_title(Menu.background_title)

        file = "%s/*%s" % (GDB.program_path, GDB.ext_program)

        code, program = d.fselect(file,
                                  title="Seleção do programa",
                                  height=30,
                                  width=100)

        if code == d.OK:
            GDB.start_debug_section(program)

        return code
예제 #26
0
    def test_simple(self):
        params = [
            DialogParam('calories'),
            DialogParam('weight'),
        ]
        state = {}

        d = Dialog(params, state)

        assert d.get_question() == 'calories?'
        assert d.set_answer(10) == Dialog.CONTINUE

        assert d.get_question() == 'weight?'
        assert d.set_answer(10) == Dialog.FINISH

        assert d.is_end()
예제 #27
0
    def select_target():

        d = Dialog(dialog="dialog")
        #d.set_background_title(Menu.background_title)

        file = "%s/*%s" % (GDB.target_path, GDB.ext_config)

        code, path = d.fselect(file,
                               title="Seleção do target",
                               height=30,
                               width=100)

        if code == d.OK:
            GDB.target = path

        return code
예제 #28
0
def shouldTweetSuffix(city, text, *, accountHint=None, oldText=None):
    fullList = nationalAccounts + accountsPerCity.get(city, tuple())
    choices = []
    for i, a in enumerate(fullList):
        choices.append((str(i), a))

    showText = '{}: {}'.format(len(text), text)
    if oldText is not None:
        showText = 'Old: {}\n{}'.format(oldText, showText)
    code, tag = Dialog().menu(text=showText,
                              choices=choices,
                              height=30,
                              width=50)
    if code == 'ok':
        return True, text + ' {account}'.format(account=fullList[int(tag)])
    return False, text
예제 #29
0
def dialog_editbox(in_text):

  dummy, temp_path = tempfile.mkstemp()
  print( temp_path )

  f = open(temp_path, 'w')
  f.write( in_text)
  f.write("\n")
  f.close()

  d = Dialog(dialog="dialog")
  d.set_background_title("Manage boards")

  code, text = d.editbox(temp_path)
  os.remove(temp_path)
  return (code, text)
def _search(title, file, metadata):
    results = MovieDbApi().search_title(title, metadata)
    # Sort by closeness to file's title, then title, then year
    if len(results) > 0:
        metadata_title = metadata.title if metadata.title is not None else ''
        results.sort(key=lambda x: (-SequenceMatcher(None, x.title, metadata_title).ratio(), x.title, x.year))
        choices = []
        for i in range(len(results)):
            choices.append((str(i), results[i].simple_name))
        d = Dialog(autowidgetsize=True)
        code, tag = d.menu('Choices:', choices=choices, title=os.path.basename(file))
        if code == d.OK:
            return OK, results[int(tag)]
        else:
            return CANCEL, None
    return OK, None