def loadRobot(self, efdir=None): if efdir is not None: fdir = efdir elif self._fdir is None: fdir = QtCore.QString(os.path.abspath(conf.robot_dirs[0])) else: fdir = self._fdir fp = QtGui.QFileDialog.getOpenFileName(self, 'Open file', fdir, 'Text files (*.py)') if fp: # Check to see if the file is already open in an editor for ed in self.editors: if ed._filepath == fp: # If it is, raise the window and get out ed.activateWindow() ed.raise_() return te = TextEditor(self) self.editors.append(te) te.openfile(fp) te.show() if efdir is None: # Opening from Main Window. Remember directory. self._fdir = te._fdir
def loadRobot(self, efdir=None): if efdir is not None: fdir = efdir elif self._fdir is None: fdir = QtCore.QString(os.path.abspath(conf.base_dir)) else: fdir = self._fdir fp = QtGui.QFileDialog.getOpenFileName(self, 'Open file', fdir, 'Text files (*.py)') if fp: # Check to see if the file is already open in an editor for ed in self.editors: if ed._filepath == fp: # If it is not visible, show it if not ed.isVisible(): ed.show() # raise the window and get out ed.activateWindow() ed.raise_() return te = TextEditor(self) self.editors.append(te) te.openfile(fp) te.show() if efdir is None: # Opening from Main Window. Remember directory. self._fdir = te._fdir
def newRobot(self): te = TextEditor(self) self.editors.append(te) te.openfile() # Open the template for a new robot te.show()
def configure(self): cd = TextEditor(self) self.editors.append(cd) cd.openfile('conf.py') cd.show()
from editor import TextEditor from text import Text if __name__ == "__main__": editor = TextEditor()