ViewManager/ViewManager.py

changeset 372
237c3fe739f5
parent 365
0686ac00256e
child 432
497e188ee86e
equal deleted inserted replaced
371:913f2c88915b 372:237c3fe739f5
5050 aw = self.activeWindow() 5050 aw = self.activeWindow()
5051 if aw is not None: 5051 if aw is not None:
5052 curline, curindex = aw.getCursorPosition() 5052 curline, curindex = aw.getCursorPosition()
5053 aw.insert(txt) 5053 aw.insert(txt)
5054 aw.setCursorPosition(curline, curindex + len(txt)) 5054 aw.setCursorPosition(curline, curindex + len(txt))
5055
5056 #######################################################################
5057 ## Numbers viewer related methods
5058 #######################################################################
5059
5060 def insertNumber(self, txt):
5061 """
5062 Private slot to insert a number text into the active window.
5063
5064 @param txt text to be inserted (string)
5065 """
5066 if self.__lastFocusWidget == e5App().getObject("Shell"):
5067 aw = e5App().getObject("Shell")
5068 if aw.hasSelectedText():
5069 aw.removeSelectedText()
5070 aw.insert(txt)
5071 elif self.__lastFocusWidget == e5App().getObject("Terminal"):
5072 aw = e5App().getObject("Terminal")
5073 if aw.hasSelectedText():
5074 aw.removeSelectedText()
5075 aw.insert(txt)
5076 else:
5077 aw = self.activeWindow()
5078 if aw is not None:
5079 if aw.hasSelectedText():
5080 aw.removeSelectedText()
5081 curline, curindex = aw.getCursorPosition()
5082 aw.insert(txt)
5083 aw.setCursorPosition(curline, curindex + len(txt))
5084
5085 def getNumber(self):
5086 """
5087 Public method to get a number from the active window.
5088
5089 @return selected text of the active window (string)
5090 """
5091 txt = ""
5092 if self.__lastFocusWidget == e5App().getObject("Shell"):
5093 aw = e5App().getObject("Shell")
5094 if aw.hasSelectedText():
5095 txt = aw.selectedText()
5096 elif self.__lastFocusWidget == e5App().getObject("Terminal"):
5097 aw = e5App().getObject("Terminal")
5098 if aw.hasSelectedText():
5099 txt = aw.selectedText()
5100 else:
5101 aw = self.activeWindow()
5102 if aw is not None:
5103 if aw.hasSelectedText():
5104 txt = aw.selectedText()
5105 return txt

eric ide

mercurial