Changeset 286 for nodebox/branches/try-qt/nodebox/gui/qt/__init__.py
- Timestamp:
- 12/21/07 14:11:13 (13 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
nodebox/branches/try-qt/nodebox/gui/qt/__init__.py
r285 r286 8 8 9 9 from PyQt4.QtGui import QApplication, QWidget, QColor, QPainter, QMenuBar, QMenu, QKeySequence, QTextEdit, QSplitter, QGridLayout, QDialog, QScrollArea, QFont, QTextCharFormat, QFileDialog, QTextCursor, QPixmap, QPrinter, QImage, QMainWindow 10 from PyQt4.QtCore import Qt, SIGNAL, SLOT, pyqtSignature, QTimer, QRectF, QSize 10 from PyQt4.QtCore import Qt, SIGNAL, SLOT, pyqtSignature, QTimer, QRectF, QSize, QCoreApplication, QSettings, QVariant 11 11 from PyQt4.QtSvg import QSvgGenerator 12 12 … … 227 227 def doOpen(self): 228 228 global app 229 fileName = QFileDialog.getOpenFileName(None, self.tr("Open File"), app. home, "*.py")229 fileName = QFileDialog.getOpenFileName(None, self.tr("Open File"), app.lastDir, "*.py") 230 230 print "open", fileName 231 231 if fileName is not None and len(fileName) > 0: … … 234 234 source = fp.read() 235 235 fp.close() 236 app.lastDir = os.path.dirname(fileName) 236 237 doc = app.newDocument() 237 238 doc.fileName = fileName … … 566 567 def __init__(self, args): 567 568 QApplication.__init__(self, args) 569 QCoreApplication.setOrganizationName("NodeBox") 570 QCoreApplication.setOrganizationDomain("nodebox.net") 571 QCoreApplication.setApplicationName("NodeBox") 572 self.settings = QSettings() 568 573 loadConfig() 569 574 self.documents = [] … … 577 582 self.home = os.getenv('HOME') 578 583 self.lib = os.path.join(self.home, "nodebox") 584 self._lastDir = self.settings.value("lastDir", QVariant(self.home)).toString() 579 585 try: 580 586 if not os.path.exists(self.lib): … … 591 597 self.documents.append(doc) 592 598 return doc 599 600 def _get_lastDir(self): 601 return self._lastDir 602 def _set_lastDir(self, lastDir): 603 self._lastDir = lastDir 604 self.settings.setValue("lastDir", QVariant(lastDir)) 605 lastDir = property(_get_lastDir, _set_lastDir) 593 606 594 607 def qtmain():
