def createGui(self, parentWindow):
        '''
    Gui comprises a formation (a structured model) and a dialog(sic) that controls it.
    The dialog is a View.  View displays the model and controls it.
    One way: user is the only one controlling the model (not any other business logic.)
    After editing formation, it is reflected (converted) to StylingActs.
    The edited formation (or at least the contents) is then discarded.
    
    Formerly, this was created on the fly then discarded, over and over.
    
    Note the gui may be QWidget based, or QML based.
    For QML, we create the gui early so that we can expose the model to it.
    '''
        self.editedFormation = self.getFormation(
            newAllSelector())  # Temporary: previous is garbage collected.
        assert self.editedFormation is not None

        # parentWindow is document so dialog centers in document.
        # If parentWindow were mainWindow (toplevel), Qt not center dialog
        self.dialog = dialogFactory.produceEditableDialog(
            parentWindow=parentWindow,
            formation=self.editedFormation,
            titleParts=(self.name, "Style Sheet"))
        # WAS flags=Qt.Sheet)
        # but that is not needed if open() which is window modal
        self.dialog.connectSignals(acceptSlot=self.acceptEdit,
                                   cancelSlot=self.cancelEdit)
Exemplo n.º 2
0
    def _newAppStyleSheetFormation(self):
        '''
    Return a new formation that covers all DocumentElement types.
    
    This also defines what can appear in an editing dialog.
    (Although an editing dialog can prune this.)
    
    Configures what Formations the app supports.
    An app need not support all the Formations the framework does.
    EG an app need not support opacity even though the framework does.
    
    Default values of Formations defined by the Framework.
    The app does not necessarily need to define defaults if the framework does.
    If the framework defaults change with new versions, the app defaults will also.
    
    Must create a new formation, since caller may edit it.
    '''
        formation = Formation(name='Application Style Sheet',
                              selector=newAllSelector())
        '''
    Configure instrumentFormations.  
    Less selective.  If user edits, affects many DEType formations.
    Optional: if not defined, the app does not allow user to edit.
    E.G. if opacity is not here, user can not edit opacity of whole document in one place.
    '''
        for instrumentFormationClass in self._allSharedInstrumentFormationClasses(
        ):
            formation.append(
                instrumentFormationClass(parentSelector=newAllSelector()))
        '''
    Configure DEType formations.
    Not optional: each DocumentElement type that the app can draw must be represented here.
    '''
        for shapeFormationClass in self._allDocumentElementTypeFormationClasses(
        ):
            formation.append(shapeFormationClass())

        return formation
Exemplo n.º 3
0
 def _newAppStyleSheetFormation(self):
   '''
   Return a new formation that covers all DocumentElement types.
   
   This also defines what can appear in an editing dialog.
   (Although an editing dialog can prune this.)
   
   Configures what Formations the app supports.
   An app need not support all the Formations the framework does.
   EG an app need not support opacity even though the framework does.
   
   Default values of Formations defined by the Framework.
   The app does not necessarily need to define defaults if the framework does.
   If the framework defaults change with new versions, the app defaults will also.
   
   Must create a new formation, since caller may edit it.
   '''
   formation = Formation( name='Application Style Sheet', selector = newAllSelector() )
   
   '''
   Configure instrumentFormations.  
   Less selective.  If user edits, affects many DEType formations.
   Optional: if not defined, the app does not allow user to edit.
   E.G. if opacity is not here, user can not edit opacity of whole document in one place.
   '''
   for instrumentFormationClass in self._allSharedInstrumentFormationClasses():
     formation.append(instrumentFormationClass(parentSelector=newAllSelector()))
   
   '''
   Configure DEType formations.
   Not optional: each DocumentElement type that the app can draw must be represented here.
   '''
   for shapeFormationClass in self._allDocumentElementTypeFormationClasses():
     formation.append(shapeFormationClass())
   
   return formation
 def createGui(self, parentWindow):
   '''
   Gui comprises a formation (a structured model) and a dialog(sic) that controls it.
   The dialog is a View.  View displays the model and controls it.
   One way: user is the only one controlling the model (not any other business logic.)
   After editing formation, it is reflected (converted) to StylingActs.
   The edited formation (or at least the contents) is then discarded.
   
   Formerly, this was created on the fly then discarded, over and over.
   
   Note the gui may be QWidget based, or QML based.
   For QML, we create the gui early so that we can expose the model to it.
   '''
   self.editedFormation = self.getFormation(newAllSelector())  # Temporary: previous is garbage collected.
   assert self.editedFormation is not None
   
   # parentWindow is document so dialog centers in document.  
   # If parentWindow were mainWindow (toplevel), Qt not center dialog
   self.dialog = dialogFactory.produceEditableDialog(parentWindow = parentWindow,
                                     formation=self.editedFormation, 
                                     titleParts = (self.name, "Style Sheet"))
                                     # WAS flags=Qt.Sheet)
                                     # but that is not needed if open() which is window modal
   self.dialog.connectSignals(acceptSlot=self.acceptEdit, cancelSlot=self.cancelEdit)