Changeset 286
- Timestamp:
- 12/21/07 14:11:13 (13 months ago)
- Location:
- nodebox/branches/try-qt/nodebox
- Files:
-
- 2 modified
-
graphics/qt.py (modified) (1 diff)
-
gui/qt/__init__.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nodebox/branches/try-qt/nodebox/graphics/qt.py
r284 r286 584 584 def _normalize(self, v): 585 585 """Bring the color into the 0-1 scale for the current colorrange""" 586 return v / self._ctx._colorrange586 return clamp(v / self._ctx._colorrange) 587 587 588 588 def _normalizeList(self, lst): 589 589 """Bring the color into the 0-1 scale for the current colorrange""" 590 return map(lambda x: x / self._ctx._colorrange, lst)590 return map(lambda x:clamp(x / self._ctx._colorrange), lst) 591 591 592 592 color = Color 593 594 def clamp(v): 595 return max(min(v, 1.0), 0.0) 593 596 594 597 class Transform(object): -
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():
