示例#1
0
    def create_actions(self):

        self.change_color_action = QtGui.QAction("Change &color", self)
        self.change_color_action.triggered.connect(self.change_color_callback)

        self.add_group_action = QtGui.QAction("&Add group", self)
        self.add_group_action.triggered.connect(self.add_group_callback)

        self.rename_group_action = QtGui.QAction("Re&name group", self)
        self.rename_group_action.setShortcut("F2")
        self.rename_group_action.triggered.connect(self.rename_group_callback)

        self.remove_group_action = QtGui.QAction("&Remove group", self)
        self.remove_group_action.triggered.connect(self.remove_group_callback)

        self.move_to_mua_action = QtGui.QAction("Move to &MUA", self)
        self.move_to_mua_action.setShortcut("Delete")
        self.move_to_mua_action.setIcon(get_icon('multiunit'))
        self.move_to_mua_action.triggered.connect(self.move_to_mua_callback)

        self.move_to_noise_action = QtGui.QAction("Move to &noise", self)
        self.move_to_noise_action.setShortcut('Shift+Delete')
        self.move_to_noise_action.setIcon(get_icon('noise'))
        self.move_to_noise_action.triggered.connect(
            self.move_to_noise_callback)

        self.move_to_good_action = QtGui.QAction("Move to &good", self)
        # self.move_to_good_action.setIcon(get_icon('noise'))
        self.move_to_good_action.triggered.connect(self.move_to_good_callback)

        # Add actions to the widget.
        self.addAction(self.change_color_action)
        self.addAction(self.add_group_action)
        self.addAction(self.rename_group_action)
        self.addAction(self.remove_group_action)
        self.addAction(self.move_to_noise_action)
        self.addAction(self.move_to_mua_action)
        self.addAction(self.move_to_good_action)
示例#2
0
 def add_action(self, name, text, callback=None, shortcut=None,
         checkable=False, checked=False, icon=None):
     action = QtGui.QAction(text, self)
     if callback is None:
         callback = getattr(self, name + '_callback', None)
     if callback:
         action.triggered.connect(callback)
     if shortcut:
         action.setShortcut(shortcut)
     if icon:
         action.setIcon(get_icon(icon))
     action.setCheckable(checkable)
     action.setChecked(checked)
     setattr(self, name + '_action', action)
示例#3
0
 def add_action(self, name, text, callback=None, shortcut=None,
         checkable=False, checked=False, icon=None):
     action = QtGui.QAction(text, self)
     if callback is None:
         callback = getattr(self, name + '_callback', None)
     if callback:
         action.triggered.connect(callback)
     if shortcut:
         action.setShortcut(shortcut)
     if icon:
         action.setIcon(get_icon(icon))
     action.setCheckable(checkable)
     action.setChecked(checked)
     setattr(self, name + '_action', action)
示例#4
0
 def create_actions(self):
     
     self.change_color_action = QtGui.QAction("Change &color", self)
     self.change_color_action.triggered.connect(self.change_color_callback)
     
     self.add_group_action = QtGui.QAction("&Add group", self)
     self.add_group_action.triggered.connect(self.add_group_callback)
     
     self.rename_group_action = QtGui.QAction("Re&name group", self)
     self.rename_group_action.setShortcut("F2")
     self.rename_group_action.triggered.connect(self.rename_group_callback)
     
     self.remove_group_action = QtGui.QAction("&Remove group", self)
     self.remove_group_action.triggered.connect(self.remove_group_callback)
     
     self.move_to_mua_action = QtGui.QAction("Move to &MUA", self)
     self.move_to_mua_action.setShortcut("Delete")
     self.move_to_mua_action.setIcon(get_icon('multiunit'))
     self.move_to_mua_action.triggered.connect(self.move_to_mua_callback)
     
     self.move_to_noise_action = QtGui.QAction("Move to &noise", self)
     self.move_to_noise_action.setShortcut('Shift+Delete')
     self.move_to_noise_action.setIcon(get_icon('noise'))
     self.move_to_noise_action.triggered.connect(self.move_to_noise_callback)
     
     self.move_to_good_action = QtGui.QAction("Move to &good", self)
     # self.move_to_good_action.setIcon(get_icon('noise'))
     self.move_to_good_action.triggered.connect(self.move_to_good_callback)
     
     # Add actions to the widget.
     self.addAction(self.change_color_action)
     self.addAction(self.add_group_action)
     self.addAction(self.rename_group_action)
     self.addAction(self.remove_group_action)
     self.addAction(self.move_to_noise_action)
     self.addAction(self.move_to_mua_action)
     self.addAction(self.move_to_good_action)
示例#5
0
文件: dock.py 项目: do-jo/klustaviewa
 def add_button(self, name, text, callback=None, shortcut=None,
         checkable=False, icon=None):
     # Creation action.
     action = QtGui.QAction(text, self)
     if callback is None:
         callback = getattr(self, name + '_callback', None)
     if callback:
         action.triggered.connect(callback)
     if shortcut:
         action.setShortcut(shortcut)
     if icon:
         action.setIcon(get_icon(icon))
     action.setCheckable(checkable)
     # Create button
     button = QtGui.QToolButton(self)
     button.setContentsMargins(*((5,)*4))
     button.setDefaultAction(action)
     return button
示例#6
0
 def add_button(self, name, text, callback=None, shortcut=None,
         checkable=False, icon=None):
     # Creation action.
     action = QtGui.QAction(text, self)
     if callback is None:
         callback = getattr(self, name + '_callback', None)
     if callback:
         action.triggered.connect(callback)
     if shortcut:
         action.setShortcut(shortcut)
     if icon:
         action.setIcon(get_icon(icon))
     action.setCheckable(checkable)
     # Create button
     button = QtGui.QToolButton(self)
     button.setContentsMargins(*((5,)*4))
     button.setDefaultAction(action)
     return button
示例#7
0
 def create_widget(self):
     
     box = QtGui.QHBoxLayout()
     if hasattr(box, 'setMargin'):
         box.setContentsMargins(QtCore.QMargins(10, 2, 10, 2))
     
     # box.addSpacing(10)
     
     # coord => channel combo box
     self.channel_box = [None, None]
     # coord => (butA, butB, butC)
     self.feature_buttons = [[None] * self.fetdim, [None] * self.fetdim]
     
     # add feature widget
     self.feature_widget1 = self.create_feature_widget(0)
     box.addLayout(self.feature_widget1)
     
     box.addSpacing(10)
     
     # Switch button.
     # button = QtGui.QPushButton('Flip', self)
     button = QtGui.QPushButton(self)
     button.setIcon(get_icon('flip'))
     button.setMaximumWidth(40)
     button.clicked.connect(self.flip_projections_callback)
     box.addWidget(button)
     
     box.addSpacing(10)
     
     # add feature widget
     self.feature_widget2 = self.create_feature_widget(1)
     box.addLayout(self.feature_widget2)
     
     # box.addSpacing(10)
     
     self.setTabOrder(self.channel_box[0], self.channel_box[1])
     
     # self.setMaximumWidth(300)
     # self.setMaximumHeight(80)
     
     
     return box
示例#8
0
 def create_widget(self):
     
     box = QtGui.QHBoxLayout()
     if hasattr(box, 'setMargin'):
         box.setContentsMargins(QtCore.QMargins(10, 2, 10, 2))
     
     # box.addSpacing(10)
     
     # coord => channel combo box
     self.channel_box = [None, None]
     # coord => (butA, butB, butC)
     self.feature_buttons = [[None] * self.fetdim, [None] * self.fetdim]
     
     # add feature widget
     self.feature_widget1 = self.create_feature_widget(0)
     box.addLayout(self.feature_widget1)
     
     box.addSpacing(10)
     
     # Switch button.
     # button = QtGui.QPushButton('Flip', self)
     button = QtGui.QPushButton(self)
     button.setIcon(get_icon('flip'))
     button.setMaximumWidth(40)
     button.clicked.connect(self.flip_projections_callback)
     box.addWidget(button)
     
     box.addSpacing(10)
     
     # add feature widget
     self.feature_widget2 = self.create_feature_widget(1)
     box.addLayout(self.feature_widget2)
     
     # box.addSpacing(10)
     
     self.setTabOrder(self.channel_box[0], self.channel_box[1])
     
     # self.setMaximumWidth(300)
     # self.setMaximumHeight(80)
     
     
     return box
示例#9
0
    def __init__(self, parent=None, dolog=True, filename=None):
        self.views = {}
        super(MainWindow, self).__init__(parent)
        self.views = {}

        # HACK: display the icon in Windows' taskbar.
        if os.name == 'nt':
            try:
                import ctypes
                myappid = 'klustateam.klustaviewa'
                ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
            except:
                pass
        
        self.dolog = dolog
        if self.dolog:
            create_file_logger()
            
        self.initialize_view_logger()
        
        log.debug("Using {0:s}.".format(QT_BINDING))
        
        # Main window options.
        self.move(50, 50)
        self.setWindowTitle('KlustaViewa')
        
        # Focus options.
        self.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.setMouseTracking(True)
        
        # Dock widgets options.
        self.setDockNestingEnabled(True)
        self.setAnimated(False)
        self.setWindowIcon(get_icon('logo'))
        
        # Initialize some variables.
        self.statscache = None
        # self.loader = KlustersLoader()
        self.loader = KwikLoader(userpref=USERPREF)
        self.loader.progressReported.connect(self.open_progress_reported)
        self.loader.saveProgressReported.connect(self.save_progress_reported)
        self.wizard = Wizard()
        self.controller = None
        self.spikes_highlighted = []
        self.spikes_selected = []
        self._wizard = False
        self.is_file_open = False
        self.need_save = False
        self.taskgraph = TaskGraph(self)
        self.busy_cursor = QtGui.QCursor(QtCore.Qt.BusyCursor)
        self.normal_cursor = QtGui.QCursor(QtCore.Qt.ArrowCursor)
        self.is_busy = False
        self.override_color = False
        self.computing_correlograms = False
        self.computing_matrix = False
        
        # Create the main window.
        self.create_views()
        self.create_file_actions()
        self.create_edit_actions()
        self.create_view_actions()
        self.create_correlograms_actions()
        self.create_control_actions()
        self.create_wizard_actions()
        self.create_help_actions()
        self.create_menu()
        self.create_toolbar()
        self.create_open_progress_dialog()
        self.create_save_progress_dialog()
        self.create_threads()
        
        # Update action enabled/disabled property.
        self.update_action_enabled()
        
        # Show the main window.
        self.set_styles()
        self.restore_geometry()
        
        # Automatically load a file upon startup if requested.
        if filename:
            filename = os.path.realpath(filename)
            self.open_task.open(self.loader, filename)
        
        self.show()
示例#10
0
    def __init__(self, parent=None, dolog=True, filename=None):
        super(KwikSkope, self).__init__(parent)

        # HACK: display the icon in Windows' taskbar.
        if os.name == 'nt':
            try:
                import ctypes
                myappid = 'klustateam.kwikskope'
                ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
                    myappid)
            except:
                pass

        self.dolog = dolog
        if self.dolog:
            create_file_logger()

        log.debug("Using {0:s}.".format(QT_BINDING))

        # Main window options.
        self.move(50, 50)
        self.setWindowTitle('KwikSkope')

        # Focus options.
        self.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.setMouseTracking(True)

        # Dock widgets options.
        self.setDockNestingEnabled(True)
        self.setAnimated(False)
        self.setWindowIcon(get_icon('logo'))

        # Initialize some variables.
        # self.statscache = None
        # self.loader = KlustersLoader()
        self.loader = HDF5Loader()
        self.loader.progressReported.connect(self.open_progress_reported)
        self.loader.saveProgressReported.connect(self.save_progress_reported)
        self.wizard = Wizard()

        self.controller = None
        self.spikes_highlighted = []
        self.spikes_selected = []
        self._wizard = False
        self.is_file_open = False
        self.need_save = False
        self.busy_cursor = QtGui.QCursor(QtCore.Qt.BusyCursor)
        self.normal_cursor = QtGui.QCursor(QtCore.Qt.ArrowCursor)
        self.is_busy = False
        self.override_color = False
        self.computing_correlograms = False
        self.computing_matrix = False

        # Create the main window.
        self.create_views()
        self.create_file_actions()
        self.create_edit_actions()
        self.create_view_actions()
        self.create_help_actions()
        self.create_menu()
        self.create_toolbar()
        self.create_open_progress_dialog()
        self.create_save_progress_dialog()
        self.create_threads()

        # Update action enabled/disabled property.
        self.update_action_enabled()

        # Show the main window.
        self.set_styles()
        self.restore_geometry()

        # Automatically load a file upon startup if requested.
        if filename:
            filename = os.path.realpath(filename)
            self.open_task.open(self.loader, filename)

        self.show()