Ejemplo n.º 1
0
    def on_volume(self, event):
        '''Set volume multiplier coeff'''
        # If nothing selected
        if self.list_ctrl.GetFirstSelected() == -1:
            return

        # Ask user to enter volume level
        volume_x = wx.GetNumberFromUser('Multiply' +\
                                        'current auduio volume level by',
                                        '\u00D7',
                                        'Volume', 1, 0, 100)

        # If user cancel - break
        if volume_x == -1:
            return

        selected = -1

        # Update volume values
        while True:
            selected = self.list_ctrl.GetNextItem(selected, wx.LIST_NEXT_ALL,
                                                  wx.LIST_STATE_SELECTED)

            if selected == -1:
                break

            self.files[selected].volume = volume_x

        # Re-draw the table
        self.update_list()
Ejemplo n.º 2
0
    def on_bitrate(self, event):
        '''Set new bitrate'''
        # If nothing selected
        if self.list_ctrl.GetFirstSelected() == -1:
            return

        # Ask user to enter bitrate
        new_bitrate = wx.GetNumberFromUser('Set new bitrate', '\u2248',
                                           'Bitrate', 130, 65, 245)
        # If user cancel - break
        if new_bitrate == -1:
            return

        selected = -1

        # Update bitrate values
        while True:
            selected = self.list_ctrl.GetNextItem(selected, wx.LIST_NEXT_ALL,
                                                  wx.LIST_STATE_SELECTED)

            if selected == -1:
                break

            self.files[selected].bitrate = new_bitrate

        # Re-draw the table
        self.update_list()
Ejemplo n.º 3
0
    def onAdd(self, event):
        wildcard = "Processes (*.json)|*.json"
        dialog = wx.FileDialog(self,
                               "Open Process",
                               wildcard=wildcard,
                               style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
                               defaultDir="./processes")

        if dialog.ShowModal() == wx.ID_CANCEL:
            return

        path = dialog.GetPath()

        x = wx.GetNumberFromUser(
            "OS Simulator",
            "How many of this process would you like to open?",
            "User Entry",
            5,
            max=1000,
            parent=self)
        if x < 1:
            return

        if os.path.exists(path):
            sim_mailbox.put(c.Cmd_CreateProcess(path, x))
        else:
            msg = wx.MessageDialog(self, "File does not exist!", style=wx.OK)
            msg.ShowModal()
Ejemplo n.º 4
0
    def OnNewRegisterClicked(self, event):
        self.new_register.Enable(False)
        self.finish_register.Enable(True)
        self.loadDataBase(1)
        while self.id == ID_WORKER_UNAVIABLE:
            self.id = wx.GetNumberFromUser(message="请输入您的工号(-1不可用)",
                                           prompt="工号",
                                           caption="温馨提示",
                                           value=ID_WORKER_UNAVIABLE,
                                           parent=self.bmp,
                                           max=100000000,
                                           min=ID_WORKER_UNAVIABLE)
            for knew_id in self.knew_id:
                if knew_id == self.id:
                    self.id = ID_WORKER_UNAVIABLE
                    wx.MessageBox(message="工号已存在,请重新输入", caption="警告")

        while self.name == '':
            self.name = wx.GetTextFromUser(message="请输入您的的姓名,用于创建姓名文件夹",
                                           caption="温馨提示",
                                           default_value="",
                                           parent=self.bmp)

            # 监测是否重名
            for exsit_name in (os.listdir(PATH_FACE)):
                if self.name == exsit_name:
                    wx.MessageBox(message="姓名文件夹已存在,请重新输入", caption="警告")
                    self.name = ''
                    break

        os.makedirs(PATH_FACE + self.name)
        _thread.start_new_thread(self.register_cap, (event, ))
        pass
Ejemplo n.º 5
0
 def OnSetMin(self, evt):
     minpane = wx.GetNumberFromUser("Enter the minimum pane size", "",
                                    "Minimum Pane Size", self.minpane, 0,
                                    1000, self)
     if minpane != -1:
         self.minpane = minpane
         self.sp.SetMinimumPaneSize(self.minpane)
Ejemplo n.º 6
0
 def OnSetPos(self, evt):
     initpos = wx.GetNumberFromUser(
         "Enter the initial sash position (to be used in the Split call)",
         "", "Initial Sash Position", self.initpos,
         -1000, 1000, self)
     if initpos != -1:
         self.initpos = initpos
Ejemplo n.º 7
0
    def OnNewEntryClicked(self, event):
        self.new_entry.Enable(False)
        self.finish_entry.Enable(True)
        self.callDataBase(1)
        while self.id == ID_STUDENT_SIGN:
            self.id = wx.GetNumberFromUser(message="请输入您的学号",
                                           prompt="学号",
                                           caption="提示",
                                           value=ID_STUDENT_SIGN,
                                           parent=self.bmp,
                                           max=100000000,
                                           min=ID_STUDENT_SIGN)
            for knew_id in self.knew_id:
                if knew_id == self.id:
                    self.id = ID_STUDENT_SIGN
                    wx.MessageBox(message="学号已存在,请重新输入", caption="提示")

        while self.name == '':
            self.name = wx.GetTextFromUser(message="请输入您的的姓名,用于创建姓名文件夹",
                                           caption="提示",
                                           default_value="",
                                           parent=self.bmp)

            for exsit_name in (os.listdir(PATH_FACE)):
                if self.name == exsit_name:
                    wx.MessageBox(message="姓名文件夹已存在,请重新输入", caption="警告")
                    self.name = ''
                    break
        os.makedirs(PATH_FACE + self.name)
        _thread.start_new_thread(self.entry_cap, (event, ))
        pass
Ejemplo n.º 8
0
def scan_parameter(frame, row):
    ''' scan_parameter(frame, row) --> None
    
    Scans the parameter in row row [int] from max to min in the number
    of steps given by dialog input.
    '''
    if not frame.model.is_compiled():
        ShowNotificationDialog(frame, 'Please conduct a simulation before' +\
        ' scanning a parameter. The script needs to be compiled.')
        return

    try:
        step = wx.GetNumberFromUser(message='Input the number of evaluation points for the scan',\
                    prompt='Steps', caption='', value=50, min=2, max=1000)
        frame.main_frame_statusbar.SetStatusText('Scanning parameter', 1)
        x, y = frame.solver_control.ScanParameter(row, step)
        fs, pars = frame.model.get_sim_pars()
        bestx = frame.model.parameters.get_data()[row][1]
        besty = frame.model.fom

        frame.plot_fomscan.SetPlottype('scan')
        frame.plot_fomscan.Plot((x, y, bestx, besty,\
                    frame.solver_control.fom_error_bars_level))
        frame.plot_notebook.SetSelection(3)
    except Exception as e:
        outp = io.StringIO()
        traceback.print_exc(200, outp)
        val = outp.getvalue()
        outp.close()
        ShowErrorDialog(frame, val)
        frame.main_frame_statusbar.SetStatusText('Fatal Error - scan fom', 1)
    else:
        frame.main_frame_statusbar.SetStatusText('Scanning finished', 1)
Ejemplo n.º 9
0
def run_tool(window_parent, device):

    # ask user for selected channel (single choice)
    choices = []
    for n in range(0, 4):
        choices.append("Digital Output " + str(n))

    dlg = wx.SingleChoiceDialog(window_parent, message="Select which output to control",\
                                caption="Output Selection", choices=choices)
    dlg.SetSelection(0)
    outDigPin = 0
    if dlg.ShowModal() == wx.ID_OK:
        outDigPin = dlg.GetSelection()
    else:
        return
    dlg.Destroy()
    digIdx = outDigPin + 1
    digIdx = 2**(digIdx - 1)

    # set pulse duration
    # as it is, it takes only round numbers (integers) - 5 Dec 2017
    # GetNumberFromUser only takes long values, not float
    duration = 0.1
    while True:
        duration = wx.GetNumberFromUser("Pulse Duration: (>0.1)", "seconds", \
                                "Duration", duration,1,20,window_parent,wx.DefaultPosition)
        if duration > 0.1:
            break
    dur = str(duration)
    print "duration: ", duration, " dur: ", dur

    # set pulse period
    period = 1.1
    while True:
        period = wx.GetNumberFromUser("Pulse Period: (>"+dur+")", "seconds", "Period",\
                                period,2,10000,window_parent,wx.DefaultPosition)
        if period > duration:
            break

    print "period: ", period
    delay = period - duration
    print "delay: ", delay

    trig = TrigGen(window_parent, title, device, \
                   digIdx, duration, delay, xSize, ySize,\
                   pulsing)
    trig.Show()
Ejemplo n.º 10
0
 def OnScrollIncr(self, ev):
     i = ev.GetId() - (Menu_ScrollIncrementMenu + 1)
     self.scrollIncr = scrollIncrL[i]
     if type(self.scrollIncr) is type(
             "ss") and self.scrollIncr[-3:] == '...':
         i = wx.GetNumberFromUser("scroll step increment:", 'step',
                                  "scroll step increment:", 10, 1, 1000)
         self.scrollIncr = i
Ejemplo n.º 11
0
        def setDecim(event, self=self):  # , row=row):
            n = wx.GetNumberFromUser("Number of decimal places", "",
                                     "number of decimals", self.table.decimals)
            if n < 0:
                return

            self.table.decimals = n
            self.Refresh()
Ejemplo n.º 12
0
        def setWidth(event, self=self):  #, row=row):
            n = wx.GetNumberFromUser("Width of each cell", "", "Cell width",
                                     self.table.width)
            if n < 0:
                return

            self.table.width = n
            self.Refresh()
Ejemplo n.º 13
0
 def OnTrans(self, event):
     r = wx.GetNumberFromUser(u'请选择透明度',
                              '',
                              'wxpython Notebook',
                              80,
                              min=30)
     if r != -1:
         self.frame.SetTransparent((r * 255 / 100))
         self.Refresh()
Ejemplo n.º 14
0
 def OnSetPeriod(self, evt):
     n = wx.GetNumberFromUser("Enter period in seconds",
                              "",
                              "Stop Watch",
                              self.GetPeriod(),
                              min=1,
                              max=1000 * 60)
     if n != -1:
         self.SetPeriod(n)
Ejemplo n.º 15
0
Archivo: main.py Proyecto: sooheng/wxGo
    def OnPos(self, event):

        num = wx.GetNumberFromUser(message='',
                                   prompt='',
                                   caption="插入的断点",
                                   value=0,
                                   min=0,
                                   max=len(dataBoard.nodes))
        if num != -1:
            self.mode.pos = num
Ejemplo n.º 16
0
 def Goto(self, line=-1):
     if line == -1:
         count = self.GetLineCount()
         line = wx.GetNumberFromUser(
             _("Enter a line number between 1 and %d:") % count,
             _("Go to line:"), _("Go to"),
             self.GetCurrentLine() + 1, 1, count, self._frame) - 1
     if line >= 0:
         self.EnsureVisible(line)
         self.GotoLine(line)
Ejemplo n.º 17
0
 def OnSetGridSize(self, event):
     value = wx.GetNumberFromUser("New grid size in mm (1..100):",
                                  "",
                                  "Set grid size",
                                  self.gridStepSize,
                                  min=1,
                                  max=100)
     if (value >= 1):
         self.gridStepSize = value
         self.InitBuffer()
Ejemplo n.º 18
0
 def onGainButton(self, evt):
     if 'gain' not in self.settings:
         return
     desc = self.describe_setting('gain')
     mingain, maxgain = desc['values']
     gain = wx.GetNumberFromUser('Gain', '', 'Set gain', value=self.settings.get('gain', 0),
                                 min=mingain, max=maxgain)
     if gain == -1:
         return
     self.updateSettings({'gain': gain})
Ejemplo n.º 19
0
 def onSpeed(self, event):
     x = wx.GetNumberFromUser(
         "OS Simulator",
         "Enter a new refresh rate in hundredths of a second: ",
         "User Entry",
         5,
         max=1000,
         parent=self)
     if x < 1:
         return
     sim_mailbox.put(c.Cmd_ChangeSpeed(x))
Ejemplo n.º 20
0
    def onQuant(self, event):
        x = wx.GetNumberFromUser("OS Simulator",
                                 "What would you like the quantum to be?",
                                 "User Entry",
                                 10,
                                 max=1000,
                                 parent=self)
        if x < 0:
            return

        sim_mailbox.put(c.Cmd_Quantum(x))
Ejemplo n.º 21
0
Archivo: main.py Proyecto: sooheng/wxGo
 def OnClk(self, event):
     '''定时的时间设置事件处理'''
     clktime = wx.GetNumberFromUser(message='ms为单位:',
                                    prompt='',
                                    caption="定时器的间隔时间",
                                    value=self.clktime,
                                    min=0,
                                    max=60000)
     if clktime >= 0:
         self.clktime = clktime
         if self.timer.IsRunning():
             self.timer.Start(self.clktime)
Ejemplo n.º 22
0
Archivo: p.py Proyecto: lujinda/pylot
 def setTimer(self, event):
     dialog = wx.GetNumberFromUser(
         message='请输入一个5到6000之间的秒数\n(如果网络环境不好,请设置长一点)',
         prompt='秒数:',
         caption='设置自动刷新时间',
         value=self.secTimer / 1000,
         min=5,
         max=6000,
         parent=None)
     if 10 <= dialog <= 6000:
         self.secTimer = dialog * 1000
         if self.timer.IsRunning(): self.timer.Start(self.secTimer)
Ejemplo n.º 23
0
    def onRand(self, event):
        x = wx.GetNumberFromUser(
            "OS Simulator",
            "How many of this process would you like to open?",
            "User Entry",
            5,
            max=1000,
            parent=self)
        if x < 0:
            return

        sim_mailbox.put(c.Cmd_RandProcess(x))
Ejemplo n.º 24
0
 def OnNormalize(self, evt):
     target = wx.GetNumberFromUser(
         "Enter the normalization target",
         "Target LUFS",
         self.m_normalizeBtn.GetLabel(),
         value=-23,
         min=-50,
         max=-6,
         parent=self
     )
     if target != -1:
         tracks = self.GetSelectedTrackNames() or TrackList.track_names()
         for path in tracks:
             TrackList.normalize_track(path, target)
Ejemplo n.º 25
0
 def OnMenu(self, event):
     if event.Id == ID_GET_DUR:
         msg = "Enter the alarm timer duration."
         num = wx.GetNumberFromUser(msg, "Duration (sec):", "Timer Setting",
                                    self._duration, 0, 360)
         self._duration = num
         self.ResetAlarm()
     elif event.Id == ID_START:
         self.ResetAlarm()
     elif event.Id == wx.ID_STOP:
         self._timer.Stop()
     elif event.Id == wx.ID_EXIT:
         self.Destroy()
     else:
         event.Skip()
Ejemplo n.º 26
0
    def on_track_num(self, event):
        '''Edit Track number'''
        selected = self.list_ctrl.GetFirstSelected()

        # If no file selected or many items selected - break
        if self.list_ctrl.GetSelectedItemCount() == 0:
            return

        # If a single file is selected
        elif self.list_ctrl.GetSelectedItemCount() == 1:
            track_num = wx.GetNumberFromUser('Enter track number:', 'n°',
                                             'Track number',
                                             self.files[selected].track_num, 0,
                                             10000)
            # If user cancel - break
            if track_num == -1:
                return

            # Update track number
            self.files[selected].track_num = track_num
            # Re-draw table
            self.update_list()
            return

        # If multiple (2 and more) files are selected - generate automatically
        # track numbers for all files in the list
        elif self.list_ctrl.GetSelectedItemCount() > 1:
            message = "Track numbers will be generated automatically" +\
                        " for all files in the list. Proceed?"
            dlg = wx.MessageDialog(self,
                                   message=message,
                                   caption='Track numbers',
                                   style=wx.YES | wx.NO | wx.CENTRE,
                                   pos=wx.DefaultPosition)

            if dlg.ShowModal() == wx.ID_YES:

                index = 1
                for file in self.files:
                    file.track_num = index
                    index += 1

                # Re-draw table
                self.update_list()
                return
Ejemplo n.º 27
0
    def OnStep(self, e):
        if self.process is None:
            msg = wx.MessageDialog(self,
                                   "No executable has been loaded",
                                   style=wx.OK)
            msg.ShowModal()
            return

        error = self.process.run()
        if error:
            if error == "user entry":
                x = wx.GetNumberFromUser("Syscall",
                                         "Enter a number",
                                         "User Entry",
                                         5,
                                         min=1,
                                         max=25,
                                         parent=self)
                self.process.setAccumulator(max(x, 0))
            else:
                msg = wx.MessageDialog(self, error, style=wx.OK)
                msg.ShowModal()

        self.SetStrings()
Ejemplo n.º 28
0
import wx


if __name__ == '__main__':
    app = wx.App()
    app.MainLoop()
    ret = wx.GetNumberFromUser("Get number from user:"******"Get number function", 10, min=-10, max=100)
    if ret == -1:
        print('press cancel.')
    else:
        print('press ok, input number %d' % ret)
Ejemplo n.º 29
0
def run_tool(window_parent, device):
	nAvg = wx.GetNumberFromUser("Samples to average:", "Average size", "Average Filter", device.propCom.nAvg,1,100,window_parent,wx.DefaultPosition)
	if nAvg < 1:
		return
	device.setNAvg( nAvg )
Ejemplo n.º 30
0
def 组件_数值对话框(标题="请设置数值", 提示="", 参数提示="", 默认值=1, 最小值=1, 最大值=100, 父窗口=None):
    "不能在线程里调用,弹出一个设置数值的对话框"
    return wx.GetNumberFromUser(提示, 参数提示, 标题, 默认值, 最小值, 最大值, 父窗口)