Ejemplo n.º 1
0
  def __init__(self, parent):
    ViewerWithTreeBase.__init__(self, parent, ArchitectureViewForm[0])

    self.current_stereotype = ''

    # Create the tree model viewers
    tree_models = {self.ui.wdgBlocks:model.ArchitectureBlock,
                   self.ui.wdgViews:model.View,
                   self.ui.wdgRequirements:model.Requirement,
                   self.ui.wdgBugs:model.Bug,
                   self.ui.wdgActions:model.FunctionPoint}
    self.tree_models = tree_models
    self.createTreeViewers()
    # Let a view be shown when double clicked in the tree viewer.
    self.ui.wdgViews.ui.tree.itemDoubleClicked.connect(self.onView)

    self.ui.tabGraphicViews.tabCloseRequested.connect(self.onTabCloseRequested)
    self.ui.tabGraphicViews.currentChanged.connect(self.onTabChanged)

    self.ui.cmbRole.activated.connect(self.onRoleChanged)
    
    self.ui.btnShowStyles.clicked.connect(self.onShowStyles)
    self.stateWindow = StyleEditor()
    self.stateWindow.hide()

    self.ui.chkFunctionFP.stateChanged.connect(lambda i: theController.setFpAsCall(bool(i)))
    
        
    # Add database hooks to properly update when items are added.
    for cls in [model.ArchitectureBlock, model.View, model.Requirement, model.Bug,
                model.FunctionPoint]:
      event.listen(cls, 'after_update', self.onDetailUpdate)
      event.listen(cls, 'after_insert', self.onDetailInsert)
      #FIXME: also handle deletes.
    self.hasEvents = True
Ejemplo n.º 2
0
 def open(self, session):
   ViewerWithTreeBase.open(self, session)
   
   # Populate the workers list.
   workers = self.session.query(model.Worker).all()
   for details in workers:
     item = QtGui.QListWidgetItem(details.Name, self.ui.lstWorkers)
     item.details = details
Ejemplo n.º 3
0
  def open(self, session):
    ViewerWithTreeBase.open(self, session)
    self.stateWindow.session = session

    # Create the drop-down list for stylesheets
    stylesheets = self.session.query(model.Style.Name).all()
    stylesheets = [s[0] for s in stylesheets]
    self.ui.cmbRole.clear()
Ejemplo n.º 4
0
  def close(self):
    ''' Overrides the QWidget.close. '''
    # Unsubscribe to database events.
    for cls in [model.ArchitectureBlock, model.View, model.Requirement, model.Bug,
                model.FunctionPoint]:
      try:
        event.remove(cls, 'after_update', self.onDetailUpdate)
        event.remove(cls, 'after_insert', self.onDetailInsert)
      except sqlalchemy.exc.InvalidRequestError:
        # No event handlers were found: ignore.
        pass
    self.hasEvents = False

    ViewerWithTreeBase.close(self)
Ejemplo n.º 5
0
  def __init__(self, parent):
    ViewerWithTreeBase.__init__(self, parent, ProjectViewForm[0])
    
    tree_models = {self.ui.wdgProjects:model.Project}
    self.tree_models = tree_models
    self.createTreeViewers()
      
    # Add a context menu to the workers viewer
    actions = [('Add', self.onAddWorker), ('Delete', self.onDeleteWorker)]
    mkMenu(actions, self, self.ui.lstWorkers)

    # Add a context menu to the projects viewer
    self.ui.wdgProjects.ui.tree.item_actions.append(('Planning Details', self.onEstimateDetails))

    # If a project is double-clicked, the planning overview is shown.
    self.ui.wdgProjects.ui.tree.itemDoubleClicked.connect(self.onViewPlanning)
    # If a worker is double-clicked, the worker overview is shown.
    self.ui.lstWorkers.itemDoubleClicked.connect(self.onViewWorker)
    # If a worker is selected, his/her details are shown.
    self.ui.lstWorkers.itemClicked.connect(lambda item: self.openDetailsViewer(item.details))
Ejemplo n.º 6
0
 def onItemSelectionChanged(self, details):
   ''' Overload of the function inherited from the viewer base.
   '''
   ViewerWithTreeBase.onItemSelectionChanged(self, details)
   self.updateRole()