Show
Ignore:
Timestamp:
12/04/07 17:21:07 (13 months ago)
Author:
fdb
Message:

Undo/redo support, window menu

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • nodebox/branches/try-qt/nodebox/gui/qt/__init__.py

    r259 r260  
    9191    def __init__(self, parent=None): 
    9292        QTextEdit.__init__(self, parent) 
    93         self.connect 
    9493         
    9594    def mousePressEvent(self, event): 
     
    110109        QWidget.__init__(self) 
    111110 
     111        self.createGUI() 
    112112        self.createMenu() 
    113         self.createGUI() 
    114113 
    115114        self.namespace = {} 
     
    148147 
    149148        self.editMenu = QMenu(self.tr("&Edit"), self) 
    150         self.editMenu.addAction(self.tr("&Undo"), self, SLOT("doUndo()"), QKeySequence("Ctrl+Z")) 
    151         self.editMenu.addAction(self.tr("&Redo"), self, SLOT("doRedo()"), QKeySequence("Ctrl+Shift+Z")) 
     149        self.editMenu.addAction(self.tr("&Undo"), self.codeView, SLOT("undo()"), QKeySequence("Ctrl+Z")) 
     150        self.editMenu.addAction(self.tr("&Redo"), self.codeView, SLOT("redo()"), QKeySequence("Ctrl+Shift+Z")) 
    152151        self.editMenu.addSeparator() 
    153152        self.menuBar.addMenu(self.editMenu) 
     
    157156        self.runAction = self.pythonMenu.addAction(self.tr("&Stop"), self, SLOT("doStop()"), QKeySequence("Ctrl+.")) 
    158157        self.menuBar.addMenu(self.pythonMenu) 
     158 
     159        self.windowMenu = QMenu(self.tr("&Window"), self) 
     160        self.windowMenu.addAction(self.tr("&Minimize"), self, SLOT("showMinimized()"), QKeySequence("Ctrl+M")) 
     161        self.windowMenu.addAction(self.tr("&Zoom"), self, SLOT("showMaximized()")) 
     162        self.windowMenu.addSeparator() 
     163        self.windowMenu.addAction(self.tr("&Bring All to Front"), self, SLOT("showNormal()"), QKeySequence("Ctrl+Shift+Z")) # TODO: Correct behaviour 
     164        self.windowMenu.addSeparator() 
     165        # TODO: List of all windows 
     166        self.menuBar.addMenu(self.windowMenu) 
    159167 
    160168    def createGUI(self): 
     
    169177        self.graphicsView = NodeBoxGraphicsView() 
    170178        self.graphicsView.document = self 
     179        self.graphicsView.resize(1000, 1000) 
    171180        self.graphicsScroll = QScrollArea() 
    172181        self.graphicsScroll.setWidget(self.graphicsView) 
     
    198207        self.setLayout(mainLayout) 
    199208 
    200         self.setWindowTitle(self.tr("NodeBox")) 
     209        self.setWindowTitle(self.tr("Untitled")) 
     210        self.resize(800, 600) 
    201211         
    202212    @pyqtSignature("") 
     
    305315 
    306316    def _runScript(self, compile=True, newSeed=True): 
    307         print "_runScript" 
    308317        if not self.cleanRun(self._execScript): 
    309318            pass 
    310319 
    311320        # Check whether we are dealing with animation 
    312         print "speed", self.canvas.speed 
    313321        if self.canvas.speed is not None: 
    314322            if not self.namespace.has_key("draw"):