Exemplo n.º 1
0
    def set_breakpoint(self, bpdata):
        """
        Set a break point
        bpdata = {id, filename, lineno, condition, ignore_count, trigger_count}
        where id should be a unique identifier for this breakpoint
        """
        #check if the id to use already exists.
        if self.bpoints.filter(('id', ), (id, )):
            return False

        #check bpdata
        keys = list(bpdata.keys())
        if 'id' not in keys:
            bpdata['id'] = EngineDebugger.bpnum
            EngineDebugger.bpnum += 1
        elif 'filename' not in keys:
            return False
        elif 'lineno' not in keys:
            return False
        if 'condition' not in keys:
            bpdata['condition'] = ""
        if 'hitcount' not in keys:
            bpdata['hitcount'] = ""

        bpdata['tcount'] = 0

        #create new breakpoint
        bpdata['filename'] = self._abs_filename(bpdata['filename'])
        self.bpoints.append(bpdata)
        dp.send('debugger.breakpoint_added', bpdata=bpdata)
        return True
Exemplo n.º 2
0
 def OnProcessEvent(self, event):
     items = self.tree.GetSelections()
     cmd = []
     for item in items:
         cmd.append(self.tree.GetItemText(item))
     evtId = event.GetId()
     if evtId in (wx.ID_COPY, wx.ID_CUT):
         clipData = wx.TextDataObject()
         clipData.SetText("\n".join(cmd))
         wx.TheClipboard.Open()
         wx.TheClipboard.SetData(clipData)
         wx.TheClipboard.Close()
         if evtId == wx.ID_CUT:
             for item in items:
                 if self.tree.ItemHasChildren(item):
                     self.tree.DeleteChildren(item)
                 self.tree.Delete(item)
     elif evtId == self.ID_EXECUTE:
         for c in cmd:
             dp.send(signal='shell.run', command=c)
     elif evtId == wx.ID_DELETE:
         for item in items:
             if self.tree.ItemHasChildren(item):
                 self.tree.DeleteChildren(item)
             self.tree.Delete(item)
     elif evtId == wx.ID_CLEAR:
         self.tree.DeleteAllItems()
Exemplo n.º 3
0
	def __init__(self):
		super().__init__(
			wx.GetTopLevelWindows()[0],  # parent
			title=f'Logs - {str(config.version)}',  # window title
			# those styles make so that the window can't minimize, maximize, resize and show on the taskbar
			style=wx.FRAME_NO_TASKBAR | wxStyles.TITLEBAR_ONLY_BUTTON_CLOSE ^ wx.RESIZE_BORDER
		)  # init the window
		logWindow.instance = self
		self.SetIcon( utilities.icon )
		self.SetSize(0, 0, 500, 365)
		sizer = wx.FlexGridSizer( rows=2, cols=1, gap=wx.Size(0, 0) )
		try:
			pos = config.load('logWindowPos')
			if pos is not None:
				self.SetPosition( wx.Point( pos ) )
			else:
				self.SetPosition( wx.Point( 100, 100 ) )
		except config.ConfigError as e:
			logger.warning(e)  # not a problem if it fails
		self.text = wx.TextCtrl(
			self,
			style=wx.TE_MULTILINE | wx.TE_READONLY | wx.VSCROLL | wx.TE_RICH,
			size=wx.Size( self.GetSize()[0], 300 )
		)  # make the textbox
		self.logHandler = logHandler()
		# set the log message format
		self.logHandler.setFormatter(
			logging.Formatter(
				# One letter for level name
				'[{levelname[0]}] {module}.{funcName}(): {message}\n',
				style='{',
			)
		)
		self.logHandler.setLevel(getLevel())
		logging.getLogger().addHandler(self.logHandler)
		# create bottom bar
		self.bottomBar = wx.Panel( self, size=wx.Size( self.GetSize()[0], 30) )  # makes the bottom "menu" bar
		self.clearBtn = wx.Button(  # makes the clear button
			self.bottomBar,
			label='Clear',
			size=wx.Size(52, 22),
			pos=wx.Point(10, 3)
		)
		self.levelChoice = wx.Choice(
			parent=self.bottomBar,
			size=wx.Size(80, 22),
			pos=wx.Point(self.GetSize()[0]-100, 3),
			choices=['Debug', 'Info', 'Warning', 'Error']
		)
		self.levelChoice.SetSelection( ( getLevel() / 10 ) - 1 )
		sizer.Add(self.text, border=wx.Bottom)
		sizer.Add(self.bottomBar)
		self.SetSizer(sizer)
		self.Bind( wx.EVT_CLOSE, self.OnClose, self )
		self.Bind( wx.EVT_MOVE_END, self.OnMoveEnd, self )
		self.Bind( wx.EVT_BUTTON, self.OnClearButtonPressed, self.clearBtn )
		self.Bind( wx.EVT_CHOICE, self.OnLevelChoice, self.levelChoice )
		dispatcher.send(Events.LogWindowCreated, window=self)
		updateVisibility()
		self.levelChoice.Refresh()
Exemplo n.º 4
0
	def OnPick(self, obj):
		if isinstance(obj, Atom):
			if self.atom1==None:
				self.atom1 = obj
			else:
				send(signal = "Bond Added", sender = "VTK Window", atom1 = self.atom1, atom2 = obj)
				self.atom1 = None
    def startDownload(self,
                      url: str,
                      callback: Callable[[downloadThread], None],
                      maxSpeed: int = 1024) -> int:
        """
		This method starts a new download
		:param url: the url of the file to download
		:param callback: the callback that will be called every time the download progresses or finishes
		:param maxSpeed: maximum chunk size
		:return: the id of the download
		"""
        downloadId = len(self.downloads)
        minusDone = False
        # search for a free ID
        while downloadId in self.downloads.keys():
            if minusDone:
                downloadId -= 1
            else:
                downloadId += 1
        # setup and start the download thread
        self.downloads[downloadId] = downloadThread(url, callback, maxSpeed)
        self.downloads[downloadId].setName(f'DownloadThread-{downloadId}')
        if not self._syncMode:
            self.downloads[downloadId].start()
        dispatcher.send(Events.DownloadStarted, url=url, downloadId=downloadId)
        return downloadId
Exemplo n.º 6
0
		def imageOutputFunction(spinsFile, imageNum):
			"""This funstion is passed to CSim.createVideo to handle creation of
			the images."""
			imagePath = "C:\\monteCarloSnapshots\\" + imageName(imageNum)
			#Load the spins and render
			self.session.loadSpinFile(spinsFile)
			#Output to image
			send("Save Image", sender = "Main Frame", path = imagePath)
Exemplo n.º 7
0
 def LoadHistory(self):
     self.clearHistory()
     resp = dp.send('frame.get_config', group='shell', key='history')
     if resp and resp[0][1]:
         self.history = resp[0][1]
     resp = dp.send('frame.get_config', group='shell', key='alias')
     if resp and resp[0][1]:
         aliasDict.update(resp[0][1])
Exemplo n.º 8
0
 def OnMenuCmdUI(self, event):
     idx = event.GetId()
     signal = self.menuAddon.get(idx, None)
     if signal:
         signal = signal[1]
         dp.send(signal=signal, event=event)
     else:
         event.Enable(True)
	def OnPageChanged(self, event):
		"""Page changed event handler."""
		new = event.GetSelection()
		window = self.GetPage(new)
		#if new.__class__=="<class 'wx.html.HtmlWindow'>":		#Paolo-temporaneo
		#	return
		dispatcher.send(signal='EditorChange', sender=self,editor=window.editor)
		window.SetFocus()
		event.Skip()
Exemplo n.º 10
0
	def OnSaveImage(self, evt):
		"""Saves an image of the current rendering.  Currently only .tiff
		format is used."""
		saveDialog = wx.FileDialog(self, "Save Image", style = wx.SAVE, wildcard = "*.tiff")

		#If the user clicked OK in the save dialog, use the filename they chose
		if saveDialog.ShowModal() == wx.ID_OK:
			send("Save Image", sender = "Main Frame", path = saveDialog.GetPath())
		saveDialog.Destroy()
Exemplo n.º 11
0
 def OnItemActivated(self, event):
     currentItem = event.m_itemIndex
     filename = self.listctrl.GetItem(currentItem, 2).GetText()
     lineno = self.listctrl.GetItem(currentItem, 1).GetText()
     # open the script first
     dp.send(signal='frame.file_drop',
             filename=filename,
             lineno=int(lineno))
     # ask the debugger to trigger the update scope event to set mark
     dp.send(signal='debugger.set_scope', level=currentItem)
Exemplo n.º 12
0
 def OnClose(self, event):
     """close the main program"""
     dp.send('frame.closing', event=event)
     if event.GetVeto():
         return
     self.closing = True
     self.SetConfig('mainframe', perspective=self._mgr.SavePerspective())
     dp.send('frame.exit')
     self.config.Flush()
     super(MainFrame, self).OnClose(event)
Exemplo n.º 13
0
 def setMatrix(self):
     """If the radio button is set to fixed values, then the values of the
     parameters will be set to the values entered in the grid.  The numbers
     should be validated first before this function is called."""
     if self.fixedValues:
         for i in range(3):
             for j in range(3):
                 self.matrix[i][j].value = float(self.grid.GetCellValue(i,j))
                 self.matrix[i][j].default = self.matrix[i][j].value
                 self.matrix[i][j].fit = False
                 send(signal = "Parameter Values Changed", sender = "Jij Dialog")
Exemplo n.º 14
0
    def OnPaneActivated(self, event):
        """notify the window managers that the panel is activated"""
        if self.closing:
            return
        pane = event.GetPane()
        if isinstance(pane, aui.auibook.AuiNotebook):
            window = pane.GetCurrentPage()
        else:
            window = pane

        dp.send('frame.activate_panel', pane=window)
Exemplo n.º 15
0
    def end(self):
        """ End the debugging and finish running the code """
        #set the end flag and wake the traceback function
        #if necessary
        self._end = True
        self._resume = True
        self._resume_event.set()

        # send the notification, the debugger may stop after the notification
        dp.send('debugger.ended')
        return True
Exemplo n.º 16
0
    def OnDebugEnded(cls):
        """debugger is ended"""
        # disable and hide the debugger toolbar
        for k in six.iterkeys(cls.menus):
            cls.tbDebug.EnableTool(k, False)
        cls.tbDebug.Refresh(False)

        # hide the debugger toolbar and Stack panel
        dp.send('frame.show_panel', panel=cls.tbDebug, show=False)
        dp.send('frame.show_panel', panel=cls.panelStack, show=False)
        # show the Stack panel next time
        cls.showStackPanel = True
Exemplo n.º 17
0
 def initialize(cls, frame):
     if cls.frame:
         return
     cls.frame = frame
     if not frame:
         return
     dp.connect(cls.uninitialize, 'frame.exit')
     # waves panel
     cls.panel = cls(frame)
     dp.send(signal='frame.add_panel',
             panel=cls.panel,
             title="wave",
             showhidemenu='View:Panels:Wave')
Exemplo n.º 18
0
    def _process_dbg_source(self, line):
        """
        Process a line of user input as python source to execute in the active
        scope
        """
        ##line is user python command compile it
        ismore, code, err = self.compiler.compile(line)

        #need more
        #   - tell the console to prompt for more
        if ismore:
            self.prompt(ismore=True)
            return

        #syntax error
        #   - compiler will output the error
        #   - tell the console to prompt for new command
        if err:
            self.prompt(iserr=True)
            return

        #no code object - could be a blank line
        if code is None:
            self.prompt()
            return

        ##run the code in the active scope
        _, frame, g, l = self.get_scope(self._active_scope)
        try:
            exec(code, g, l)
        except SystemExit:
            self.write_debug('Blocking system exit')
        except KeyboardInterrupt:
            self._paused = False
            raise KeyboardInterrupt
        except:
            #engine wanted to stop anyway - probably wxPython keyboard interrupt error
            if self._stop is True:
                self._paused = False
                raise KeyboardInterrupt

            #error in user code.
            self.compiler.show_traceback()

        #update the locals
        self._update_frame_locals(frame)

        ##Finished running the code - prompt for a new command
        # add the command to history
        dp.send('shell.add_to_history', command=line)
        self.prompt()
Exemplo n.º 19
0
 def addFigure(cls, title=None, num=None, thisFig=None):
     direction = cls.kwargs.get('direction', 'top')
     fig = cls(cls.clsFrame, title=title, num=num, thisFig=thisFig)
     # set the minsize to be large enough to avoid some following assert; it
     # will not eliminate all as if a page is added to a notebook, the
     # minsize of notebook is not the max of all its children pages (check
     # frameplus.py).
     # wxpython/ext/wxWidgets/src/gtk/bitmap.cpp(539): assert ""width > 0 &&
     # height > 0"" failed in Create(): invalid bitmap size
     dp.send('frame.add_panel',
             panel=fig,
             direction=direction,
             title=fig.GetTitle(),
             target=Gcf.get_active(),
             minsize=(75, 75))
     return fig
Exemplo n.º 20
0
    def pick(self, obj, event):
        Mouse_Position = self.iren.GetEventPosition()
        self.picker.PickProp(Mouse_Position[0],Mouse_Position[1], self.ren1)
        if(self.SelectedActor == self.picker.GetActor()): #the actor is already picked
            return
        if(self.SelectedActor != None):
            self.SelectedActor.GetProperty().SetAmbient(0) #unhighlight old picked actor
        self.SelectedActor = self.picker.GetActor()
        if self.SelectedActor != None:
            self.SelectedActor.GetProperty().SetAmbient(self.highlight_level)#make the selected actor stand out
            self.iren.GetRenderWindow().Render()
            #find the Atom at this position and print its description
            modelObj = self.drawer.getObjFromActor(self.SelectedActor)
#            print "sending signal pick..."
            send(signal = "Pick Event", sender = "Picker", obj = modelObj)
            actors = self.ren1.GetActors()
Exemplo n.º 21
0
 def OnLeftDClick(self, event):
     line_num = self.GetCurrentLine()
     line = self.GetLine(line_num)
     filepath = re.findall('[Ff]ile [^,]+,', line)
     if filepath:
         path = (filepath[0])[6:-2]
         linenum = re.findall(r'line \d+', line, re.IGNORECASE)
         if linenum:
             linenum = int((linenum[0])[5:])
         else:
             linenum = 1
         dp.send('frame.file_drop',
                 filename=path,
                 activated=True,
                 lineno=linenum)
     event.Skip()
Exemplo n.º 22
0
 def OnItemActivated(self, event):
     currentItem = event.GetItem()
     filename = self.dirtree.GetItemText(currentItem)
     parentItem = self.dirtree.GetItemParent(currentItem)
     d = self.dirtree.GetItemData(parentItem)
     if isinstance(d, Directory):
         filepath = os.path.join(d.directory, filename)
     else:
         return
     if self.dirtree.ItemHasChildren(currentItem):
         self.dirtree.SetRootDir(filepath)
         return
     (_, ext) = os.path.splitext(filename)
     if ext == '.py':
         dp.send(signal='frame.file_drop', filename=filepath)
     else:
         os.system("start " + filepath)
Exemplo n.º 23
0
 def Initialize(cls, frame, **kwargs):
     cls.frame = frame
     dp.connect(receiver=cls.Uninitialize, signal='frame.exit')
     ns = {}
     ns['wx'] = wx
     ns['app'] = wx.GetApp()
     ns['frame'] = cls.frame
     intro = 'Welcome To bsmedit ' + __version__
     cls.panelShell = Shell(cls.frame, introText=intro, locals=ns)
     active = kwargs.get('active', True)
     direction = kwargs.get('direction', 'top')
     dp.send(signal="frame.add_panel",
             panel=cls.panelShell,
             active=active,
             title="Shell",
             showhidemenu="View:Panels:Console",
             direction=direction)
Exemplo n.º 24
0
    def OnDebugPaused(cls):
        """update the debug toolbar status"""
        resp = dp.send('debugger.get_status')
        if not resp or not resp[0][1]:
            return
        status = resp[0][1]
        paused = status['paused']
        for k, s in six.iteritems(cls.menus):
            cls.tbDebug.EnableTool(k, paused and status.get(s, False))
        cls.tbDebug.Refresh(False)
        if paused and not cls.tbDebug.IsShown():
            dp.send('frame.show_panel', panel=cls.tbDebug)

        if cls.showStackPanel and paused and not cls.panelStack.IsShown():
            dp.send('frame.show_panel', panel=cls.panelStack)
            # allow the use to hide the Stack panel
            cls.showStackPanel = False
Exemplo n.º 25
0
    def _InsertProperty(self, prop, index=-1, update=True):
        # add the prop window to the grid
        if not isinstance(prop, Property):
            return None

        if index == -1 or index >= self.GetPropCount():
            self._props.append(prop)
        else:
            self._props.insert(index, prop)
        name = prop.GetName()

        if index != -1 and (not update):
            self.CheckProp()
        if update:
            self.UpdateGrid()
        if self.SendPropEvent(wxEVT_PROP_INSERT, prop):
            dp.send('prop.insert', prop=prop)
        return prop
Exemplo n.º 26
0
    def Destroy(self):
        self.debugger.release()
        # save command history
        dp.send('frame.set_config', group='shell', history=self.history)
        dp.send('frame.set_config', group='shell', alias=aliasDict)

        dp.disconnect(self.writeOut, 'shell.write_out')
        dp.disconnect(self.runCommand, 'shell.run')
        dp.disconnect(self.debugPrompt, 'shell.prompt')
        dp.disconnect(self.addHistory, 'shell.add_to_history')
        dp.disconnect(self.IsDebuggerOn, 'debugger.debugging')
        dp.disconnect(self.getAutoCompleteList, 'shell.auto_complete_list')
        dp.disconnect(self.getAutoCompleteKeys, 'shell.auto_complete_keys')
        dp.disconnect(self.getAutoCallTip, 'shell.auto_call_tip')
        dp.disconnect(self.OnActivatePanel, 'frame.activate_panel')
        dp.disconnect(self.OnActivate, 'frame.activate')
        dp.disconnect(self.OnFrameClosing, 'frame.closing')
        super(Shell, self).Destroy()
Exemplo n.º 27
0
 def completer(self, query):
     response = dp.send(signal='shell.auto_complete_list', command=query)
     if response:
         root = query[0:query.rfind('.') + 1]
         remain = query[query.rfind('.') + 1:]
         remain = remain.lower()
         objs = [o for o in response[0][1] if o.lower().startswith(remain)]
         return objs, objs, len(query) - len(root)
     return [], [], 0
Exemplo n.º 28
0
 def OnTieCellClick(self, event):
     """When a cell in the parameter tying matrices is clicked and the
     Control Key is held, it will be tied to the last parameter to be
     clicked.  Otherwise, if the Control Key is not held, the parameter will
     be tied to any parameters which are clicked later while holding the
     Control Key."""
     
     col=event.GetCol()
     row=event.GetRow()
     grid = event.GetEventObject()
     #Get the parameter object from the associated edit_grid
     edit_grid = self.edit_grids[self.tie_grids.index(grid)]
     param = edit_grid.GetTable().GetParameter(row, col)
     if not wx.GetMouseState().ControlDown():
         self.selected_parameter = param
     else:
         self.selected_parameter.tieTo(param.GetIndex())
     self.UpdateTables()
     send(signal = "Parameter Values Changed", sender = "Jij Dialog")
Exemplo n.º 29
0
    def clear_breakpoint(self, id):
        """
        Clear the debugger breakpoint with the id given.
        If id is None all breakpoints will be cleared.
        """
        if id is None:
            self.bpoints.clear()
            return True

        #check if the id to clear exists.
        bps = self.bpoints.filter(('id', ), (id, ))
        if not bps:
            return False

        #remove the breakpoint
        bp = bps[0]
        self.bpoints.remove(bp)
        dp.send('debugger.breakpoint_cleared', bpdata=bp)
        return True
Exemplo n.º 30
0
 def pick(self, obj, event):
     Mouse_Position = self.iren.GetEventPosition()
     self.picker.PickProp(Mouse_Position[0], Mouse_Position[1], self.ren1)
     if (self.SelectedActor == self.picker.GetActor()
         ):  #the actor is already picked
         return
     if (self.SelectedActor != None):
         self.SelectedActor.GetProperty().SetAmbient(
             0)  #unhighlight old picked actor
     self.SelectedActor = self.picker.GetActor()
     if self.SelectedActor != None:
         self.SelectedActor.GetProperty().SetAmbient(
             self.highlight_level)  #make the selected actor stand out
         self.iren.GetRenderWindow().Render()
         #find the Atom at this position and print its description
         modelObj = self.drawer.getObjFromActor(self.SelectedActor)
         #            print "sending signal pick..."
         send(signal="Pick Event", sender="Picker", obj=modelObj)
         actors = self.ren1.GetActors()
Exemplo n.º 31
0
    def set_scope(self, level, silent=False):
        """
        Set the scope level to use for interogration when paused. This will be
        reset at the next pause (i.e. after stepping).
        """
        #check level is an int
        if isinstance(level, int) is False:
            return False
        #check level is in range
        if level > (len(self._scopes) - 1):
            return False
        #check if already in this level
        if level == self._active_scope:
            return True
        self._active_scope = level

        #send scope change message
        if not silent:
            dp.send('debugger.update_scopes')
        return True
Exemplo n.º 32
0
    def push(self, command, silent=False, history=True):
        """Send command to the interpreter for execution."""
        self.running = True
        if not silent:
            self.write(os.linesep)
        # push to the debugger
        if self.waiting and self.IsDebuggerOn():
            self.debugger.push_line(command)
            return
        # DNM
        cmd_raw = command
        if pyshell.USE_MAGIC:
            command = magic(command)
        if len(command) > 1 and command[-1] == ';':
            self.silent = True

        self.waiting = True
        self.lastUpdate = None
        try:
            if self.enable_debugger:
                self.debugger.reset()
                sys.settrace(self.debugger)
            self.more = self.interp.push(command)
        except:
            traceback.print_exc(file=sys.stdout)
        finally:
            # make sure debugger.ended is always sent; more does not hurt
            if self.enable_debugger:
                dp.send('debugger.ended')
                self.debugger.reset()
                self.enable_debugger = False

        sys.settrace(None)
        self.lastUpdate = None
        self.waiting = False
        self.silent = False
        if not self.more and history:
            self.addHistory(cmd_raw)
        if not silent:
            self.prompt()
        self.running = False
Exemplo n.º 33
0
    def stop_code(self):
        """
        Attempt to stop the running code by raising a keyboard interrupt in
        the main thread
        """
        self._stop = True  #stops the code if paused
        if self._paused is True:
            self.prompt()

        self._resume_event.set()

        #try a keyboard interrupt - this will not work for the internal engine
        # as the error is raised here instead of the running code, hence put in
        #try clause.
        try:
            thread.interrupt_main()
        except:
            pass

        # send the notification, the debugger may stop after the notification
        dp.send('debugger.ended')
Exemplo n.º 34
0
 def autoCallTipShow(self, command, insertcalltip=True, forceCallTip=False):
     """Display argument spec and docstring in a popup window."""
     if self.CallTipActive():
         self.CallTipCancel()
     (name, argspec, tip) = self.interp.getCallTip(command)
     if tip:
         dp.send('Shell.calltip', sender=self, calltip=tip)
     if not self.autoCallTip and not forceCallTip:
         return
     startpos = self.GetCurrentPos()
     if argspec and insertcalltip and self.callTipInsert:
         self.write(argspec + ')')
         endpos = self.GetCurrentPos()
         self.SetSelection(startpos, endpos)
     if argspec:
         tippos = startpos
         fallback = startpos - self.GetColumn(startpos)
         # In case there isn't enough room, only go back to the
         # fallback.
         tippos = max(tippos, fallback)
         self.CallTipShow(tippos, argspec)
Exemplo n.º 35
0
    def OnOk(self, event): # wxGlade: ParamDialog.<event_handler>
        valid, fixed, val, min, max, tiedParams, default = self.validate()
        if valid:
            self.param.fit = not fixed
            if self.param.fit:
                self.param.min = min
                self.param.max = max
                self.param.default = default
                if self.param.fit:
                    self.param.tieToMany(tiedParams)
            else:
                self.param.tieToMany([])#untie all if it is set to a fixed value
                self.param.value = val
                self.param.default = val

            event.Skip()#Exit
            
            #test
            for param in self.param.manager.parameters:
                print param.tied
        
        send(signal = "Parameter Values Changed", sender = "Parameter Dialog")
Exemplo n.º 36
0
 def autoCallTipShow(self, command):
     """Display argument spec and docstring in a popup window."""
     if self.CallTipActive():
         self.CallTipCancel()
     (name, argspec, tip) = self.interp.getCallTip(command)
     if tip:
         dispatcher.send(signal='Shell.calltip', sender=self, calltip=tip)
     if not self.autoCallTip:
         return
     if argspec:
         startpos = self.GetCurrentPos()
         self.write(argspec + ')')
         endpos = self.GetCurrentPos()
         self.SetSelection(endpos, startpos)
     if tip:
         curpos = self.GetCurrentPos()
         tippos = curpos - (len(name) + 1)
         fallback = curpos - self.GetColumn(curpos)
         # In case there isn't enough room, only go back to the
         # fallback.
         tippos = max(tippos, fallback)
         self.CallTipShow(tippos, tip)
Exemplo n.º 37
0
    def OnUpdateMenuUI(cls, event):
        """update the debugger toolbar"""
        eid = event.GetId()
        resp = dp.send('debugger.get_status')
        enable = False
        if resp and resp[0][1]:
            status = resp[0][1]
            paused = status['paused']

            s = cls.menus.get(eid, 'paused')

            enable = paused and status[s]
        event.Enable(enable)
Exemplo n.º 38
0
    def OnDrop(self, x, y, name):
        """drop the property"""
        pt = wx.Point(x, y)
        pt = self.CalcUnscrolledPosition(pt)
        index2 = self.PropHitTest(pt)
        prop = self.GetProperty(index2)
        # insert a property? Let the parent to determine what to do
        if PropGrid.drag_prop is None:
            dp.send('prop.drop', index=index2, prop=name, grid=self)
            return

        if name != PropGrid.drag_prop.GetName():
            # something is wrong
            return

        index = PropGrid.drag_pg.FindPropertyIndex(PropGrid.drag_prop)
        if index == -1:
            # not find the dragged property, do nothing
            return

        if PropGrid.drag_pg != self:
            # drop the property from the other window, copy it
            indent = PropGrid.drag_prop.GetIndent()
            self.CopyProperty(PropGrid.drag_prop, index2)
            for i in six.moves.range(index + 1,
                                     PropGrid.drag_pg.GetPropCount()):
                # copy all its children
                child = PropGrid.drag_pg.GetProperty(i)
                if child.GetIndent() <= indent:
                    break
                if index2 != -1:
                    index2 = index2 + 1
                self.CopyProperty(child, index2)
        else:
            # move the property if necessary
            if prop == PropGrid.drag_prop:
                return
            self.doMoveProperty(index, index2)
        self.UpdateGrid()
Exemplo n.º 39
0
 def sendsignal(event): send(signal,sender=sender,who=who)
 return sendsignal
Exemplo n.º 40
0
    def OnUseResults(self, event): # wxGlade: FitResultPanel.<event_handler>
	#send a message to the current session object(should only effect the one in the same process)
	send(signal = "Use Fit Data", sender = "fitResultPanel", bondTable = self.fitSession.bondTable)
        event.Skip()