Exemplo n.º 1
0
    def __init__(self):
        DockArea.__init__(self)

        self.project_tree_dock = Dock(u"Project Tree", hideTitle=True)
        self.addDock(self.project_tree_dock,
                     'top')  #'above', self.flowcharts_dock)

        self.project_tree = SegmentTreeWidget()

        self.project_tree_dock.addWidget(self.project_tree)

        self.properties_table = TableWidget(sortable=False, editable=False)
        self.properties_table.setFormat("%.3f", 1)
        self.properties_table.setColumnCount(1)
        self.properties_table.contextMenu.clear()
        self.properties_table.horizontalHeader().hide()

        self.properties_dock = Dock("Selected Object Properties",
                                    widget=self.properties_table,
                                    hideTitle=True)
        self.addDock(self.properties_dock, 'bottom')

        MarkWriteMainWindow.instance().sigProjectChanged.connect(
            self.handleProjectChange)
        MarkWriteMainWindow.instance().sigSegmentCreated.connect(
            self.handleSegmentCreated)
        MarkWriteMainWindow.instance().sigSegmentRemoved.connect(
            self.handleSegmentRemoved)
        MarkWriteMainWindow.instance().sigActiveObjectChanged.connect(
            self.handleActiveObjectChanged)

        self.project_tree.currentItemChanged.connect(
            self.currentTreeItemChangedEvent)
        self.project_tree.itemDoubleClicked.connect(
            self.treeItemDoubleClickedEvent)
        self.project_tree.customContextMenuRequested.connect(
            self.rightClickTreeEvent)
        #       self.project_tree.itemSelectionChanged.connect(self.handleItemSelectionChanged)

        self.project_tree.setExpandsOnDoubleClick(False)

        self.doNotSetActiveObject = False
Exemplo n.º 2
0
    def __init__(self):
        DockArea.__init__(self)

        self.project_tree_dock = Dock(u"Project Tree", hideTitle=True)
        self.addDock(self.project_tree_dock,
                     'top')  #'above', self.flowcharts_dock)

        self.project_tree = SegmentTreeWidget()

        self.project_tree_dock.addWidget(self.project_tree)

        self.properties_table = TableWidget(sortable=False, editable=False)
        self.properties_table.setFormat("%.3f",1)
        self.properties_table.setColumnCount(1)
        self.properties_table.contextMenu.clear()
        self.properties_table.horizontalHeader().hide()

        self.properties_dock = Dock("Selected Object Properties",
                                    widget=self.properties_table,
                                    hideTitle=True)
        self.addDock(self.properties_dock, 'bottom')

        MarkWriteMainWindow.instance().sigProjectChanged.connect(
            self.handleProjectChange)
        MarkWriteMainWindow.instance().sigSegmentCreated.connect(
            self.handleSegmentCreated)
        MarkWriteMainWindow.instance().sigSegmentRemoved.connect(
            self.handleSegmentRemoved)
        MarkWriteMainWindow.instance().sigActiveObjectChanged.connect(
            self.handleActiveObjectChanged)

        self.project_tree.currentItemChanged.connect(
            self.currentTreeItemChangedEvent)
        self.project_tree.itemDoubleClicked.connect(
            self.treeItemDoubleClickedEvent)
        self.project_tree.customContextMenuRequested.connect(
            self.rightClickTreeEvent)
 #       self.project_tree.itemSelectionChanged.connect(self.handleItemSelectionChanged)

        self.project_tree.setExpandsOnDoubleClick(False)

        self.doNotSetActiveObject=False
Exemplo n.º 3
0
class SegmentInfoDockArea(DockArea):
    segid2treenode = WeakValueDictionary()

    def __init__(self):
        DockArea.__init__(self)

        self.project_tree_dock = Dock(u"Project Tree", hideTitle=True)
        self.addDock(self.project_tree_dock,
                     'top')  #'above', self.flowcharts_dock)

        self.project_tree = SegmentTreeWidget()

        self.project_tree_dock.addWidget(self.project_tree)

        self.properties_table = TableWidget(sortable=False, editable=False)
        self.properties_table.setFormat("%.3f",1)
        self.properties_table.setColumnCount(1)
        self.properties_table.contextMenu.clear()
        self.properties_table.horizontalHeader().hide()

        self.properties_dock = Dock("Selected Object Properties",
                                    widget=self.properties_table,
                                    hideTitle=True)
        self.addDock(self.properties_dock, 'bottom')

        MarkWriteMainWindow.instance().sigProjectChanged.connect(
            self.handleProjectChange)
        MarkWriteMainWindow.instance().sigSegmentCreated.connect(
            self.handleSegmentCreated)
        MarkWriteMainWindow.instance().sigSegmentRemoved.connect(
            self.handleSegmentRemoved)
        MarkWriteMainWindow.instance().sigActiveObjectChanged.connect(
            self.handleActiveObjectChanged)

        self.project_tree.currentItemChanged.connect(
            self.currentTreeItemChangedEvent)
        self.project_tree.itemDoubleClicked.connect(
            self.treeItemDoubleClickedEvent)
        self.project_tree.customContextMenuRequested.connect(
            self.rightClickTreeEvent)
 #       self.project_tree.itemSelectionChanged.connect(self.handleItemSelectionChanged)

        self.project_tree.setExpandsOnDoubleClick(False)

        self.doNotSetActiveObject=False

    def updatePropertiesTableData(self, objwithprops, cleartable=False):
        if cleartable:
            self.properties_table.clear()
            self.properties_table.horizontalHeader().setResizeMode(
                QtGui.QHeaderView.Stretch)
            self.properties_table.setData(objwithprops.propertiesTableData())
        else:
            i=0
            for v in objwithprops.propertiesTableData().values():
                self.properties_table.setRow(i,v)
                i+=1

    #
    # Signal Handlers
    #

    def handleProjectChange(self, project):
        self.project_tree.clear()
        self.segid2treenode.clear()
        # Create Project Tree Node
        projecttreeitem = QtGui.QTreeWidgetItem([project.name])
        projecttreeitem._pydat = proxy(project.segmenttree)
        self.segid2treenode[project.segmenttree.id] = projecttreeitem
        self.project_tree.addTopLevelItem(projecttreeitem)

        for seg in project.segmenttree.children:
            self.handleSegmentCreated(seg)


    def handleSegmentCreated(self, segment):
        #print '>>TREE.handleSegmentCreated:',segment
        self.doNotSetActiveObject = True
        segindex = segment.parent.getChildIndex(segment)
        parent_tree_node = self.segid2treenode[segment.parent.id]
        #parent_tree_node = self.project_tree.topLevelItem(0)
        segtreeitem = QtGui.QTreeWidgetItem([segment.name])
        self.segid2treenode[segment.id] = segtreeitem
        segtreeitem._pydat = proxy(segment)
        parent_tree_node.insertChild(segindex, segtreeitem)
        #for i in self.project_tree.selectedItems():
        #    i.setSelected(False)
        #segtreeitem.setSelected(True)
        self.project_tree.setCurrentItem(segtreeitem)
        #print '<< TREE.handleSegmentCreated'
        self.doNotSetActiveObject = False

        for seg in segment.children:
            self.handleSegmentCreated(seg)

    def handleSegmentRemoved(self, segment, segment_index):
        self.doNotSetActiveObject = True
        parent_tree_node = self.segid2treenode[segment.parent.id]
        segmenttreeitem = parent_tree_node.child(segment_index)
        parent_tree_node.removeChild(segmenttreeitem)
        self.doNotSetActiveObject = False
        if MarkWriteMainWindow.instance():
            MarkWriteMainWindow.instance().setActiveObject(segment.parent)

    def handleActiveObjectChanged(self,activeobj, prevactiveobj):
        #if activeobj != prevactiveobj:
        #    print "Active Obj Changed:",activeobj, prevactiveobj
        if activeobj:
            self.updatePropertiesTableData(activeobj, activeobj!=prevactiveobj)

        if activeobj != prevactiveobj:
            if not isinstance(activeobj,PenDataSegmentCategory):
                #print "Deselecting Tree Node.."
                # set root node as current, otherwise if user tries to press on
                # prev selected segment, tree change event will not fire.
                if self.segid2treenode.has_key(0):
                    self.project_tree.setCurrentItem(self.segid2treenode[0])
                self.project_tree.clearSelection()
                #self.project_tree.setCurrentItem(None)
            else:
                #print "Settting tree node",activeobj,self.segid2treenode[activeobj.id]
                self.project_tree.setCurrentItem(self.segid2treenode[activeobj.id])

    def rightClickTreeEvent(self, *args, **kwargs):
        # Show Segment name editing dialog
        segment = MarkWriteMainWindow.instance().activeobject
        #print "rightClickTreeEvent:",segment
        if segment:
            if isinstance(segment, PenDataSegmentCategory):
                if segment.locked is False:
                    tag, ok = showSegmentNameDialog(
                        MarkWriteMainWindow.instance().predefinedtags, default=segment.name)
                    if len(tag) > 0 and ok:
                        segment.name = tag
                        self.project_tree.selectedItems()[0].setText(0,
                                                                     segment.name)


    def currentTreeItemChangedEvent(self, *args, **kwargs):
        current_tree_item, old_tree_widget = args
        #print ">> currentTreeItemChangedEvent:",current_tree_item, old_tree_widget
#        print "  selected items:",self.project_tree.selectedItems()
        try:
            if current_tree_item is None:
                #passing in not obj sets activeObject to project.selectedtimeregion
                MarkWriteMainWindow.instance().setActiveObject()
            elif self.doNotSetActiveObject is False:
                self.project_tree.setCurrentItem(current_tree_item)
                selectedsegment = current_tree_item._pydat
                if selectedsegment.isRoot():
                    ao=MarkWriteMainWindow.instance().setActiveObject()
                else:
                    ao=MarkWriteMainWindow.instance().setActiveObject(selectedsegment)
                #print "Set active object:",ao
        except Exception, e:
            #import traceback
            #traceback.print_exc()
            self.properties_table.clear()
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.setWindowModality(QtCore.Qt.ApplicationModal)
        MainWindow.resize(902, 532)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_segment_clasif.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        MainWindow.setAutoFillBackground(False)
        MainWindow.setStyleSheet(_fromUtf8(""))
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setStyleSheet(_fromUtf8(""))
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setSizeConstraint(
            QtGui.QLayout.SetDefaultConstraint)
        self.verticalLayout_2.setMargin(0)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.widget = QSignalDetectorWidget(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.widget.sizePolicy().hasHeightForWidth())
        self.widget.setSizePolicy(sizePolicy)
        self.widget.setObjectName(_fromUtf8("widget"))
        self.verticalLayout_2.addWidget(self.widget)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.dockWidgetParameterTableOscilogram = QtGui.QDockWidget(MainWindow)
        self.dockWidgetParameterTableOscilogram.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 255, 255);"))
        self.dockWidgetParameterTableOscilogram.setObjectName(
            _fromUtf8("dockWidgetParameterTableOscilogram"))
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.dockWidgetContents)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.tableParameterOscilogram = TableWidget(self.dockWidgetContents)
        self.tableParameterOscilogram.setEditTriggers(
            QtGui.QAbstractItemView.NoEditTriggers)
        self.tableParameterOscilogram.setObjectName(
            _fromUtf8("tableParameterOscilogram"))
        self.tableParameterOscilogram.setColumnCount(0)
        self.tableParameterOscilogram.setRowCount(0)
        self.verticalLayout_3.addWidget(self.tableParameterOscilogram)
        self.dockWidgetParameterTableOscilogram.setWidget(
            self.dockWidgetContents)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(4),
                                 self.dockWidgetParameterTableOscilogram)
        self.menuBar = QtGui.QMenuBar(MainWindow)
        self.menuBar.setGeometry(QtCore.QRect(0, 0, 902, 21))
        self.menuBar.setObjectName(_fromUtf8("menuBar"))
        self.menuParameters = QtGui.QMenu(self.menuBar)
        self.menuParameters.setObjectName(_fromUtf8("menuParameters"))
        self.menuDetection = QtGui.QMenu(self.menuBar)
        self.menuDetection.setObjectName(_fromUtf8("menuDetection"))
        self.menuTools = QtGui.QMenu(self.menuBar)
        self.menuTools.setObjectName(_fromUtf8("menuTools"))
        self.menuExport = QtGui.QMenu(self.menuBar)
        self.menuExport.setObjectName(_fromUtf8("menuExport"))
        self.menuGraph_Images = QtGui.QMenu(self.menuExport)
        self.menuGraph_Images.setObjectName(_fromUtf8("menuGraph_Images"))
        MainWindow.setMenuBar(self.menuBar)
        self.toolBar = SoundLabToolBarWidget(MainWindow)
        self.toolBar.setObjectName(_fromUtf8("toolBar"))
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.actionZoomIn = QtGui.QAction(MainWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_zoom_in.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionZoomIn.setIcon(icon1)
        self.actionZoomIn.setObjectName(_fromUtf8("actionZoomIn"))
        self.actionZoom_out = QtGui.QAction(MainWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_zoom_out.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionZoom_out.setIcon(icon2)
        self.actionZoom_out.setObjectName(_fromUtf8("actionZoom_out"))
        self.actionSpectogram = QtGui.QAction(MainWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_spect.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSpectogram.setIcon(icon3)
        self.actionSpectogram.setObjectName(_fromUtf8("actionSpectogram"))
        self.actionOscilogram = QtGui.QAction(MainWindow)
        self.actionOscilogram.setEnabled(True)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_oscil.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionOscilogram.setIcon(icon4)
        self.actionOscilogram.setVisible(True)
        self.actionOscilogram.setObjectName(_fromUtf8("actionOscilogram"))
        self.actionCombined = QtGui.QAction(MainWindow)
        icon5 = QtGui.QIcon()
        icon5.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_oscil_spect.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionCombined.setIcon(icon5)
        self.actionCombined.setObjectName(_fromUtf8("actionCombined"))
        self.actionPlay_Sound = QtGui.QAction(MainWindow)
        icon6 = QtGui.QIcon()
        icon6.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_play.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionPlay_Sound.setIcon(icon6)
        self.actionPlay_Sound.setObjectName(_fromUtf8("actionPlay_Sound"))
        self.actionStop_Sound = QtGui.QAction(MainWindow)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_stop.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionStop_Sound.setIcon(icon7)
        self.actionStop_Sound.setObjectName(_fromUtf8("actionStop_Sound"))
        self.actionPause_Sound = QtGui.QAction(MainWindow)
        icon8 = QtGui.QIcon()
        icon8.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_pause.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionPause_Sound.setIcon(icon8)
        self.actionPause_Sound.setObjectName(_fromUtf8("actionPause_Sound"))
        self.actionZoom_out_entire_file = QtGui.QAction(MainWindow)
        icon9 = QtGui.QIcon()
        icon9.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_zoom.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionZoom_out_entire_file.setIcon(icon9)
        self.actionZoom_out_entire_file.setObjectName(
            _fromUtf8("actionZoom_out_entire_file"))
        self.actionMeditions = QtGui.QAction(MainWindow)
        icon10 = QtGui.QIcon()
        icon10.addPixmap(QtGui.QPixmap(_fromUtf8(":/myappicons/Excel.png")),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionMeditions.setIcon(icon10)
        self.actionMeditions.setObjectName(_fromUtf8("actionMeditions"))
        self.actionView_Parameters = QtGui.QAction(MainWindow)
        self.actionView_Parameters.setCheckable(True)
        self.actionView_Parameters.setObjectName(
            _fromUtf8("actionView_Parameters"))
        self.actionDetection = QtGui.QAction(MainWindow)
        self.actionDetection.setIcon(icon)
        self.actionDetection.setObjectName(_fromUtf8("actionDetection"))
        self.actionTemporal_Elements = QtGui.QAction(MainWindow)
        self.actionTemporal_Elements.setCheckable(True)
        self.actionTemporal_Elements.setChecked(True)
        self.actionTemporal_Elements.setObjectName(
            _fromUtf8("actionTemporal_Elements"))
        self.actionSpectral_Elements = QtGui.QAction(MainWindow)
        self.actionSpectral_Elements.setCheckable(True)
        self.actionSpectral_Elements.setChecked(True)
        self.actionSpectral_Elements.setObjectName(
            _fromUtf8("actionSpectral_Elements"))
        self.actionSpectral_Figures = QtGui.QAction(MainWindow)
        self.actionSpectral_Figures.setCheckable(True)
        self.actionSpectral_Figures.setChecked(True)
        self.actionSpectral_Figures.setObjectName(
            _fromUtf8("actionSpectral_Figures"))
        self.actionTemporal_Numbers = QtGui.QAction(MainWindow)
        self.actionTemporal_Numbers.setCheckable(True)
        self.actionTemporal_Numbers.setChecked(True)
        self.actionTemporal_Numbers.setObjectName(
            _fromUtf8("actionTemporal_Numbers"))
        self.actionSpectral_Numbers = QtGui.QAction(MainWindow)
        self.actionSpectral_Numbers.setCheckable(True)
        self.actionSpectral_Numbers.setChecked(True)
        self.actionSpectral_Numbers.setObjectName(
            _fromUtf8("actionSpectral_Numbers"))
        self.actionSub_Elements_Peaks = QtGui.QAction(MainWindow)
        self.actionSub_Elements_Peaks.setCheckable(True)
        self.actionSub_Elements_Peaks.setObjectName(
            _fromUtf8("actionSub_Elements_Peaks"))
        self.actionOsc_Image = QtGui.QAction(MainWindow)
        icon11 = QtGui.QIcon()
        icon11.addPixmap(QtGui.QPixmap(_fromUtf8(":/myappicons/Camera.ico")),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionOsc_Image.setIcon(icon11)
        self.actionOsc_Image.setObjectName(_fromUtf8("actionOsc_Image"))
        self.actionSpecgram_Image = QtGui.QAction(MainWindow)
        self.actionSpecgram_Image.setIcon(icon11)
        self.actionSpecgram_Image.setObjectName(
            _fromUtf8("actionSpecgram_Image"))
        self.actionTemporal_Figures = QtGui.QAction(MainWindow)
        self.actionTemporal_Figures.setCheckable(True)
        self.actionTemporal_Figures.setChecked(True)
        self.actionTemporal_Figures.setObjectName(
            _fromUtf8("actionTemporal_Figures"))
        self.actionCombined_Image = QtGui.QAction(MainWindow)
        icon12 = QtGui.QIcon()
        icon12.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/Photofiltre.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionCombined_Image.setIcon(icon12)
        self.actionCombined_Image.setObjectName(
            _fromUtf8("actionCombined_Image"))
        self.actionFull_Screen = QtGui.QAction(MainWindow)
        self.actionFull_Screen.setCheckable(True)
        icon13 = QtGui.QIcon()
        icon13.addPixmap(QtGui.QPixmap(_fromUtf8(":/myappicons/Position.png")),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionFull_Screen.setIcon(icon13)
        self.actionFull_Screen.setObjectName(_fromUtf8("actionFull_Screen"))
        self.actionExit = QtGui.QAction(MainWindow)
        icon14 = QtGui.QIcon()
        icon14.addPixmap(QtGui.QPixmap(_fromUtf8(":/myappicons/cerrar.png")),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionExit.setIcon(icon14)
        self.actionExit.setObjectName(_fromUtf8("actionExit"))
        self.actionRectangular_Cursor = QtGui.QAction(MainWindow)
        self.actionRectangular_Cursor.setCheckable(True)
        self.actionRectangular_Cursor.setObjectName(
            _fromUtf8("actionRectangular_Cursor"))
        self.actionZoom_Cursor = QtGui.QAction(MainWindow)
        self.actionZoom_Cursor.setCheckable(True)
        self.actionZoom_Cursor.setChecked(True)
        self.actionZoom_Cursor.setObjectName(_fromUtf8("actionZoom_Cursor"))
        self.actionPointer_Cursor = QtGui.QAction(MainWindow)
        self.actionPointer_Cursor.setCheckable(True)
        self.actionPointer_Cursor.setObjectName(
            _fromUtf8("actionPointer_Cursor"))
        self.actionSignalName = QtGui.QAction(MainWindow)
        self.actionSignalName.setObjectName(_fromUtf8("actionSignalName"))
        self.actionDelete_Selected_Elements = QtGui.QAction(MainWindow)
        icon15 = QtGui.QIcon()
        icon15.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/deleteElements.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionDelete_Selected_Elements.setIcon(icon15)
        self.actionDelete_Selected_Elements.setObjectName(
            _fromUtf8("actionDelete_Selected_Elements"))
        self.actionDeselect_Elements = QtGui.QAction(MainWindow)
        icon16 = QtGui.QIcon()
        icon16.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/deselectElements.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionDeselect_Elements.setIcon(icon16)
        self.actionDeselect_Elements.setObjectName(
            _fromUtf8("actionDeselect_Elements"))
        self.actionTwo_Dimensional_Graphs = QtGui.QAction(MainWindow)
        icon17 = QtGui.QIcon()
        icon17.addPixmap(QtGui.QPixmap(_fromUtf8(":/myappicons/2dgraphs.png")),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionTwo_Dimensional_Graphs.setIcon(icon17)
        self.actionTwo_Dimensional_Graphs.setObjectName(
            _fromUtf8("actionTwo_Dimensional_Graphs"))
        self.actionRecord = QtGui.QAction(MainWindow)
        icon18 = QtGui.QIcon()
        icon18.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/record_26x26.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRecord.setIcon(icon18)
        self.actionRecord.setObjectName(_fromUtf8("actionRecord"))
        self.actionPlayLoop = QtGui.QAction(MainWindow)
        self.actionPlayLoop.setCheckable(True)
        icon19 = QtGui.QIcon()
        icon19.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/button_loop.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionPlayLoop.setIcon(icon19)
        self.actionPlayLoop.setObjectName(_fromUtf8("actionPlayLoop"))
        self.actionAddElement = QtGui.QAction(MainWindow)
        icon20 = QtGui.QIcon()
        icon20.addPixmap(QtGui.QPixmap(_fromUtf8(":/myappicons/add.png")),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionAddElement.setIcon(icon20)
        self.actionAddElement.setObjectName(_fromUtf8("actionAddElement"))
        self.actionSound_File_Segmentation = QtGui.QAction(MainWindow)
        icon21 = QtGui.QIcon()
        icon21.addPixmap(QtGui.QPixmap(_fromUtf8(":/myappicons/225.ico")),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSound_File_Segmentation.setIcon(icon21)
        self.actionSound_File_Segmentation.setObjectName(
            _fromUtf8("actionSound_File_Segmentation"))
        self.actionTemporal_Parameters = QtGui.QAction(MainWindow)
        self.actionTemporal_Parameters.setCheckable(True)
        self.actionTemporal_Parameters.setChecked(True)
        self.actionTemporal_Parameters.setObjectName(
            _fromUtf8("actionTemporal_Parameters"))
        self.actionSpectral_Parameters = QtGui.QAction(MainWindow)
        self.actionSpectral_Parameters.setCheckable(True)
        self.actionSpectral_Parameters.setChecked(True)
        self.actionSpectral_Parameters.setObjectName(
            _fromUtf8("actionSpectral_Parameters"))
        self.actionCross_correlation = QtGui.QAction(MainWindow)
        icon22 = QtGui.QIcon()
        icon22.addPixmap(
            QtGui.QPixmap(_fromUtf8(":/myappicons/cross-correlation.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionCross_correlation.setIcon(icon22)
        self.actionCross_correlation.setObjectName(
            _fromUtf8("actionCross_correlation"))
        self.actionSelectedElement_Correlation = QtGui.QAction(MainWindow)
        self.actionSelectedElement_Correlation.setObjectName(
            _fromUtf8("actionSelectedElement_Correlation"))
        self.actionClassify = QtGui.QAction(MainWindow)
        self.actionClassify.setObjectName(_fromUtf8("actionClassify"))
        self.actionDelete_All = QtGui.QAction(MainWindow)
        self.actionDelete_All.setObjectName(_fromUtf8("actionDelete_All"))
        self.actionParameter_Measurement = QtGui.QAction(MainWindow)
        self.actionParameter_Measurement.setObjectName(
            _fromUtf8("actionParameter_Measurement"))
        self.actionGroupByParameter = QtGui.QAction(MainWindow)
        self.actionGroupByParameter.setCheckable(True)
        self.actionGroupByParameter.setChecked(True)
        self.actionGroupByParameter.setObjectName(
            _fromUtf8("actionGroupByParameter"))
        self.actionGroupByLocation = QtGui.QAction(MainWindow)
        self.actionGroupByLocation.setCheckable(True)
        self.actionGroupByLocation.setChecked(False)
        self.actionGroupByLocation.setObjectName(
            _fromUtf8("actionGroupByLocation"))
        self.actionGroupNone = QtGui.QAction(MainWindow)
        self.actionGroupNone.setCheckable(True)
        self.actionGroupNone.setChecked(False)
        self.actionGroupNone.setObjectName(_fromUtf8("actionGroupNone"))
        self.menuParameters.addAction(self.actionView_Parameters)
        self.menuParameters.addAction(self.actionFull_Screen)
        self.menuParameters.addSeparator()
        self.menuParameters.addAction(self.actionTwo_Dimensional_Graphs)
        self.menuParameters.addSeparator()
        self.menuParameters.addAction(self.actionTemporal_Elements)
        self.menuParameters.addAction(self.actionTemporal_Numbers)
        self.menuParameters.addAction(self.actionTemporal_Figures)
        self.menuParameters.addAction(self.actionTemporal_Parameters)
        self.menuParameters.addSeparator()
        self.menuParameters.addAction(self.actionSpectral_Elements)
        self.menuParameters.addAction(self.actionSpectral_Numbers)
        self.menuParameters.addAction(self.actionSpectral_Figures)
        self.menuParameters.addAction(self.actionSpectral_Parameters)
        self.menuParameters.addSeparator()
        self.menuDetection.addAction(self.actionAddElement)
        self.menuDetection.addAction(self.actionDelete_Selected_Elements)
        self.menuDetection.addAction(self.actionDelete_All)
        self.menuDetection.addAction(self.actionDeselect_Elements)
        self.menuDetection.addSeparator()
        self.menuDetection.addAction(self.actionDetection)
        self.menuDetection.addAction(self.actionClassify)
        self.menuDetection.addAction(self.actionParameter_Measurement)
        self.menuTools.addAction(self.actionZoomIn)
        self.menuTools.addAction(self.actionZoom_out)
        self.menuTools.addAction(self.actionZoom_out_entire_file)
        self.menuTools.addSeparator()
        self.menuTools.addAction(self.actionZoom_Cursor)
        self.menuTools.addAction(self.actionPointer_Cursor)
        self.menuTools.addAction(self.actionRectangular_Cursor)
        self.menuGraph_Images.addAction(self.actionOsc_Image)
        self.menuGraph_Images.addAction(self.actionSpecgram_Image)
        self.menuGraph_Images.addAction(self.actionCombined_Image)
        self.menuExport.addAction(self.actionMeditions)
        self.menuExport.addAction(self.actionSound_File_Segmentation)
        self.menuExport.addAction(self.menuGraph_Images.menuAction())
        self.menuBar.addAction(self.menuDetection.menuAction())
        self.menuBar.addAction(self.menuExport.menuAction())
        self.menuBar.addAction(self.menuTools.menuAction())
        self.menuBar.addAction(self.menuParameters.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 5
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(1670, 1030)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setMargin(0)
        self.gridLayout.setVerticalSpacing(7)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        
        self.graph_rawdata = PlotWidget(self.centralwidget)
        self.graph_rawdata.setObjectName(_fromUtf8("graph_rawdata"))
        self.verticalLayout.addWidget(self.graph_rawdata)
        
        
                
                
        self.update_btn = QtGui.QPushButton(self.centralwidget)
        self.update_btn.setObjectName(_fromUtf8("export_btn"))
        self.update_btn.setGeometry(QtCore.QRect(1000, 100, 150, 40))
        self.gridLayout.addWidget(self.update_btn, 0, 1, 1, 1)


        
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 2, 1)
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        
        
        
        
        
        self.tab = QtGui.QWidget()
        self.tab.setObjectName(_fromUtf8("tab"))
        self.tabWidget.addTab(self.tab, _fromUtf8(""))
       
        self.listWidget = QtGui.QListWidget(self.tab)
        self.listWidget.setGeometry(QtCore.QRect(0, 50, 321, 821))
        self.listWidget.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.listWidget.setLayoutMode(QtGui.QListView.SinglePass)
        self.listWidget.setUniformItemSizes(True)
        self.listWidget.setObjectName(_fromUtf8("listWidget"))

        #
        # self.tab_2 = QtGui.QWidget()
        # self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
        # self.tab_2.setObjectName(_fromUtf8("tab_2"))
        #
        # self.widget = QtGui.QWidget(self.tab_2)
        # self.widget.setGeometry(QtCore.QRect(11, 11, 340, 300))
        # self.widget.setObjectName(_fromUtf8("widget"))
        # self.gridLayout_2 = QtGui.QGridLayout(self.widget)
        # self.gridLayout_2.setMargin(0)
        # self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        # self.lab_smoothing = QtGui.QLabel(self.widget)
        # self.lab_smoothing.setObjectName(_fromUtf8("lab_smoothing"))
        # self.gridLayout_2.addWidget(self.lab_smoothing, 0, 0, 1, 1)
        # self.lineEdit_smoothing = QtGui.QLineEdit(self.widget)
        # self.lineEdit_smoothing.setMaxLength(3)
        # self.lineEdit_smoothing.setObjectName(_fromUtf8("lineEdit_smoothing"))
        # self.gridLayout_2.addWidget(self.lineEdit_smoothing, 0, 1, 1, 1)
        # self.slider_smoothing = QtGui.QSlider(self.widget)
        # self.slider_smoothing.setMaximum(999)
        # self.slider_smoothing.setProperty("value", 120)
        # self.slider_smoothing.setOrientation(QtCore.Qt.Horizontal)
        # self.slider_smoothing.setObjectName(_fromUtf8("slider_smoothing"))
        # self.gridLayout_2.addWidget(self.slider_smoothing, 0, 2, 1, 1)
        # self.lab_showevents = QtGui.QLabel(self.widget)
        # self.lab_showevents.setObjectName(_fromUtf8("lab_showevents"))
        # self.gridLayout_2.addWidget(self.lab_showevents, 1, 0, 1, 1)
        # spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        # self.gridLayout_2.addItem(spacerItem, 1, 1, 1, 1)
        # self.comboBox_showevents = QtGui.QComboBox(self.widget)
        # self.comboBox_showevents.setObjectName(_fromUtf8("comboBox_showevents"))
        # self.comboBox_showevents.addItem(_fromUtf8(""))
        # self.comboBox_showevents.addItem(_fromUtf8(""))
        # self.gridLayout_2.addWidget(self.comboBox_showevents, 1, 1, 1, 2)
        # self.lab_align = QtGui.QLabel(self.widget)
        # self.lab_align.setObjectName(_fromUtf8("lab_align"))
        # self.gridLayout_2.addWidget(self.lab_align, 2, 0, 1, 1)
        #
        # self.label = QtGui.QLabel(self.widget)
        # self.label.setObjectName(_fromUtf8("label"))
        # self.gridLayout_2.addWidget(self.lab_align, 4, 0, 1, 1)
        #
        # spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        # self.gridLayout_2.addItem(spacerItem1, 2, 1, 1, 1)
        # self.comboBox_align = QtGui.QComboBox(self.widget)
        # self.comboBox_align.setObjectName(_fromUtf8("comboBox_align"))
        # self.comboBox_align.addItem(_fromUtf8(""))
        # self.comboBox_align.addItem(_fromUtf8(""))
        # self.comboBox_align.addItem(_fromUtf8(""))
        # self.comboBox_align.addItem(_fromUtf8(""))
        # self.gridLayout_2.addWidget(self.comboBox_align, 4, 1, 1, 2)
        #
        # self.export_btn = QtGui.QPushButton(self.widget)
        # self.export_btn.setObjectName(_fromUtf8("export_btn"))
        # self.gridLayout_2.addWidget(self.export_btn, 5, 1, 1, 2)
        #
        # self.gridLayout_2.setColumnStretch(0, 9)
        # self.gridLayout_2.setColumnStretch(1, 1)
        # self.gridLayout_2.setColumnStretch(2, 20)


        self.tab_3 = QtGui.QWidget()
        self.tabWidget.addTab(self.tab_3, _fromUtf8(""))
        self.tab_3.setObjectName(_fromUtf8("tab_3"))
        

        self.columnlist = QtGui.QListWidget(self.tab_3)
        self.columnlist.setGeometry(QtCore.QRect(0, 50, 321, 821))
        self.columnlist.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.columnlist.setLayoutMode(QtGui.QListView.SinglePass)
        self.columnlist.setUniformItemSizes(True)
        self.columnlist.setObjectName(_fromUtf8("columnlist"))

        self.gridLayout.addWidget(self.tabWidget, 1, 1, 1, 1)
        self.gridLayout.setColumnStretch(0, 40)
        self.gridLayout.setColumnStretch(1, 8)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1670, 26))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        self.menuStart = QtGui.QMenu(self.menubar)
        self.menuStart.setObjectName(_fromUtf8("menuStart"))
        self.menuQuit = QtGui.QMenu(self.menubar)
        self.menuQuit.setObjectName(_fromUtf8("menuQuit"))
        self.menuRawdata_Graph_setup = QtGui.QMenu(self.menubar)
        self.menuRawdata_Graph_setup.setObjectName(_fromUtf8("menuRawdata_Graph_setup"))
        self.menuRates_setup = QtGui.QMenu(self.menubar)
        self.menuRates_setup.setObjectName(_fromUtf8("menuRates_setup"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.actionOpen_datafile = QtGui.QAction(MainWindow)
        self.actionOpen_datafile.setObjectName(_fromUtf8("actionOpen_datafile"))
        self.actionQuit = QtGui.QAction(MainWindow)
        self.actionQuit.setObjectName(_fromUtf8("actionQuit"))
        self.action_events = QtGui.QAction(MainWindow)
        self.action_events.setObjectName(_fromUtf8("action_events"))
        self.action_samples = QtGui.QAction(MainWindow)
        self.action_samples.setObjectName(_fromUtf8("action_samples"))
        self.action_annotate = QtGui.QAction(MainWindow)
        self.action_annotate.setObjectName(_fromUtf8("action_annotate"))
        self.action_export = QtGui.QAction(MainWindow)
        self.action_export.setObjectName(_fromUtf8("action_export"))
        self.menuStart.addAction(self.actionOpen_datafile)
        self.menuStart.addSeparator()
        self.menuStart.addAction(self.action_events)
        self.menuStart.addSeparator()
        self.menuStart.addAction(self.action_samples)
        self.menuStart.addSeparator()
        self.menuStart.addAction(self.action_annotate)
        self.menuStart.addSeparator()
        self.menuStart.addAction(self.action_export)
        self.menubar.addAction(self.menuStart.menuAction())
        self.menubar.addAction(self.menuQuit.menuAction())

        self.tab_4 = QtGui.QWidget()
        self.tabWidget.addTab(self.tab_4, _fromUtf8(""))
        self.tab_4.setObjectName(_fromUtf8("tab_4"))

        self.widget4 = QtGui.QWidget(self.tab_4)
        self.widget4.setGeometry(QtCore.QRect(11, 11, 320, 800))
        self.widget4.setObjectName(_fromUtf8("widget4"))
        self.gridLayout_4 = QtGui.QGridLayout(self.widget4)
        self.gridLayout_4.setMargin(0)
        self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))

        self.roi_btn = QtGui.QPushButton(self.widget4)
        self.roi_btn.setObjectName(_fromUtf8("roi_button"))
        self.gridLayout_4.addWidget(self.roi_btn, 1, 1, 1, 1)

        self.dataTable = TableWidget(self.widget4)
        self.dataTable.resize(800, 300)
        self.gridLayout_4.addWidget(self.dataTable, 2, 1, 1, 1)
        self.gridLayout_4.setRowStretch(2, 30)


        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        
        
        self.gridLayout.setRowStretch(0,1)
        self.gridLayout.setRowStretch(1,15)
Exemplo n.º 6
0
class SegmentInfoDockArea(DockArea):
    segid2treenode = WeakValueDictionary()

    def __init__(self):
        DockArea.__init__(self)

        self.project_tree_dock = Dock(u"Project Tree", hideTitle=True)
        self.addDock(self.project_tree_dock,
                     'top')  #'above', self.flowcharts_dock)

        self.project_tree = SegmentTreeWidget()

        self.project_tree_dock.addWidget(self.project_tree)

        self.properties_table = TableWidget(sortable=False, editable=False)
        self.properties_table.setFormat("%.3f", 1)
        self.properties_table.setColumnCount(1)
        self.properties_table.contextMenu.clear()
        self.properties_table.horizontalHeader().hide()

        self.properties_dock = Dock("Selected Object Properties",
                                    widget=self.properties_table,
                                    hideTitle=True)
        self.addDock(self.properties_dock, 'bottom')

        MarkWriteMainWindow.instance().sigProjectChanged.connect(
            self.handleProjectChange)
        MarkWriteMainWindow.instance().sigSegmentCreated.connect(
            self.handleSegmentCreated)
        MarkWriteMainWindow.instance().sigSegmentRemoved.connect(
            self.handleSegmentRemoved)
        MarkWriteMainWindow.instance().sigActiveObjectChanged.connect(
            self.handleActiveObjectChanged)

        self.project_tree.currentItemChanged.connect(
            self.currentTreeItemChangedEvent)
        self.project_tree.itemDoubleClicked.connect(
            self.treeItemDoubleClickedEvent)
        self.project_tree.customContextMenuRequested.connect(
            self.rightClickTreeEvent)
        #       self.project_tree.itemSelectionChanged.connect(self.handleItemSelectionChanged)

        self.project_tree.setExpandsOnDoubleClick(False)

        self.doNotSetActiveObject = False

    def updatePropertiesTableData(self, objwithprops, cleartable=False):
        if cleartable:
            self.properties_table.clear()
            self.properties_table.horizontalHeader().setResizeMode(
                QtGui.QHeaderView.Stretch)
            self.properties_table.setData(objwithprops.propertiesTableData())
        else:
            i = 0
            for v in objwithprops.propertiesTableData().values():
                self.properties_table.setRow(i, v)
                i += 1

    #
    # Signal Handlers
    #

    def handleProjectChange(self, project):
        self.project_tree.clear()
        self.segid2treenode.clear()
        # Create Project Tree Node
        projecttreeitem = QtGui.QTreeWidgetItem([project.name])
        projecttreeitem._pydat = proxy(project.segmenttree)
        self.segid2treenode[project.segmenttree.id] = projecttreeitem
        self.project_tree.addTopLevelItem(projecttreeitem)

        for seg in project.segmenttree.children:
            self.handleSegmentCreated(seg)

    def handleSegmentCreated(self, segment):
        #print '>>TREE.handleSegmentCreated:',segment
        self.doNotSetActiveObject = True
        segindex = segment.parent.getChildIndex(segment)
        parent_tree_node = self.segid2treenode[segment.parent.id]
        #parent_tree_node = self.project_tree.topLevelItem(0)
        segtreeitem = QtGui.QTreeWidgetItem([segment.name])
        self.segid2treenode[segment.id] = segtreeitem
        segtreeitem._pydat = proxy(segment)
        parent_tree_node.insertChild(segindex, segtreeitem)
        #for i in self.project_tree.selectedItems():
        #    i.setSelected(False)
        #segtreeitem.setSelected(True)
        self.project_tree.setCurrentItem(segtreeitem)
        #print '<< TREE.handleSegmentCreated'
        self.doNotSetActiveObject = False

        for seg in segment.children:
            self.handleSegmentCreated(seg)

    def handleSegmentRemoved(self, segment, segment_index):
        self.doNotSetActiveObject = True
        parent_tree_node = self.segid2treenode[segment.parent.id]
        segmenttreeitem = parent_tree_node.child(segment_index)
        parent_tree_node.removeChild(segmenttreeitem)
        self.doNotSetActiveObject = False
        if MarkWriteMainWindow.instance():
            MarkWriteMainWindow.instance().setActiveObject(segment.parent)

    def handleActiveObjectChanged(self, activeobj, prevactiveobj):
        #if activeobj != prevactiveobj:
        #    print "Active Obj Changed:",activeobj, prevactiveobj
        if activeobj:
            self.updatePropertiesTableData(activeobj,
                                           activeobj != prevactiveobj)

        if activeobj != prevactiveobj:
            if not isinstance(activeobj, PenDataSegmentCategory):
                #print "Deselecting Tree Node.."
                # set root node as current, otherwise if user tries to press on
                # prev selected segment, tree change event will not fire.
                if self.segid2treenode.has_key(0):
                    self.project_tree.setCurrentItem(self.segid2treenode[0])
                self.project_tree.clearSelection()
                #self.project_tree.setCurrentItem(None)
            else:
                #print "Settting tree node",activeobj,self.segid2treenode[activeobj.id]
                self.project_tree.setCurrentItem(
                    self.segid2treenode[activeobj.id])

    def rightClickTreeEvent(self, *args, **kwargs):
        # Show Segment name editing dialog
        segment = MarkWriteMainWindow.instance().activeobject
        #print "rightClickTreeEvent:",segment
        if segment:
            if isinstance(segment, PenDataSegmentCategory):
                if segment.locked is False:
                    tag, ok = showSegmentNameDialog(
                        MarkWriteMainWindow.instance().predefinedtags,
                        default=segment.name)
                    if len(tag) > 0 and ok:
                        segment.name = tag
                        self.project_tree.selectedItems()[0].setText(
                            0, segment.name)

    def currentTreeItemChangedEvent(self, *args, **kwargs):
        current_tree_item, old_tree_widget = args
        #print ">> currentTreeItemChangedEvent:",current_tree_item, old_tree_widget
        #        print "  selected items:",self.project_tree.selectedItems()
        try:
            if current_tree_item is None:
                #passing in not obj sets activeObject to project.selectedtimeregion
                MarkWriteMainWindow.instance().setActiveObject()
            elif self.doNotSetActiveObject is False:
                self.project_tree.setCurrentItem(current_tree_item)
                selectedsegment = current_tree_item._pydat
                if selectedsegment.isRoot():
                    ao = MarkWriteMainWindow.instance().setActiveObject()
                else:
                    ao = MarkWriteMainWindow.instance().setActiveObject(
                        selectedsegment)
                #print "Set active object:",ao
        except Exception, e:
            #import traceback
            #traceback.print_exc()
            self.properties_table.clear()