Skip to content

Commit

Permalink
Ability to force a certain IO instead of relying on file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
rproepp committed Jun 21, 2013
1 parent aa6f996 commit dc1783c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 12 deletions.
26 changes: 25 additions & 1 deletion spykeviewer/ui/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,23 @@ QGroupBox::title {
</attribute>
<widget class="QWidget" name="dockWidgetContents_8">
<layout class="QGridLayout" name="gridLayout_6">
<item row="1" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Format:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="neoIOComboBox"/>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QTreeView" name="fileTreeView">
<property name="selectionMode">
Expand All @@ -233,13 +250,20 @@ QGroupBox::title {
</attribute>
</widget>
</item>
<item row="1" column="0">
<item row="5" column="0">
<widget class="QPushButton" name="loadFilesButton">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="configureIOButton">
<property name="text">
<string>Configure Selected IO</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
Expand Down
19 changes: 17 additions & 2 deletions spykeviewer/ui/main_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file '/home/rob/Spyke/viewer/spykeviewer/ui/main.ui'
#
# Created: Wed Jun 19 11:08:03 2013
# Created: Thu Jun 20 17:09:43 2013
# by: PyQt4 UI code generator 4.9.3
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -105,6 +105,16 @@ def setupUi(self, MainWindow):
self.dockWidgetContents_8.setObjectName(_fromUtf8("dockWidgetContents_8"))
self.gridLayout_6 = QtGui.QGridLayout(self.dockWidgetContents_8)
self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6"))
self.formLayout = QtGui.QFormLayout()
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.label = QtGui.QLabel(self.dockWidgetContents_8)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label)
self.neoIOComboBox = QtGui.QComboBox(self.dockWidgetContents_8)
self.neoIOComboBox.setObjectName(_fromUtf8("neoIOComboBox"))
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.neoIOComboBox)
self.gridLayout_6.addLayout(self.formLayout, 1, 0, 1, 1)
self.fileTreeView = QtGui.QTreeView(self.dockWidgetContents_8)
self.fileTreeView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.fileTreeView.setUniformRowHeights(True)
Expand All @@ -116,7 +126,10 @@ def setupUi(self, MainWindow):
self.gridLayout_6.addWidget(self.fileTreeView, 0, 0, 1, 1)
self.loadFilesButton = QtGui.QPushButton(self.dockWidgetContents_8)
self.loadFilesButton.setObjectName(_fromUtf8("loadFilesButton"))
self.gridLayout_6.addWidget(self.loadFilesButton, 1, 0, 1, 1)
self.gridLayout_6.addWidget(self.loadFilesButton, 5, 0, 1, 1)
self.configureIOButton = QtGui.QPushButton(self.dockWidgetContents_8)
self.configureIOButton.setObjectName(_fromUtf8("configureIOButton"))
self.gridLayout_6.addWidget(self.configureIOButton, 2, 0, 1, 1)
self.filesDock.setWidget(self.dockWidgetContents_8)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.filesDock)
self.filterToolbar = QtGui.QToolBar(MainWindow)
Expand Down Expand Up @@ -335,7 +348,9 @@ def retranslateUi(self, MainWindow):
self.historyDock.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Command History", None, QtGui.QApplication.UnicodeUTF8))
self.pluginDock.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Plugins", None, QtGui.QApplication.UnicodeUTF8))
self.filesDock.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Files", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("MainWindow", "Format:", None, QtGui.QApplication.UnicodeUTF8))
self.loadFilesButton.setText(QtGui.QApplication.translate("MainWindow", "Load", None, QtGui.QApplication.UnicodeUTF8))
self.configureIOButton.setText(QtGui.QApplication.translate("MainWindow", "Configure Selected IO", None, QtGui.QApplication.UnicodeUTF8))
self.filterToolbar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Filter Toolbar", None, QtGui.QApplication.UnicodeUTF8))
self.pluginToolBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Plugin Toolbar", None, QtGui.QApplication.UnicodeUTF8))
self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "&Exit", None, QtGui.QApplication.UnicodeUTF8))
Expand Down
9 changes: 1 addition & 8 deletions spykeviewer/ui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@


logger = logging.getLogger('spykeviewer')
ch = logging.StreamHandler()
ch.setLevel(logging.WARNING)
logger.addHandler(ch)


# Monkeypatch variable editor
Expand Down Expand Up @@ -511,11 +508,7 @@ def run_command(self, cmd, history=True, new_prompt=True):
self.console.connect(self.console, SIGNAL("refresh()"),
self._append_python_history)

# Duplicate stdout, stderr and logging for console
ch = logging.StreamHandler(sys.stderr)
ch.setLevel(logging.WARNING)
logger.addHandler(ch)

# Duplicate stdout and stderr for console
# Not using previous stdout, only stderr. Using StreamDuplicator
# because spyder stream does not have flush() method...
sys.stdout = StreamDuplicator([sys.stdout])
Expand Down
25 changes: 24 additions & 1 deletion spykeviewer/ui/main_window_neo.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,24 @@ def reload_neo_io_plugins(self):
cl._is_spyke_plugin = True
neo.io.iolist.insert(0, cl)

# Populate IO list
self.neoIOComboBox.clear()
iolabels = []

for io in neo.io.iolist:
if io.name:
iolabels.append((io.name, io))
else:
iolabels.append((io.__name__, io))

iolabels.sort(key=lambda x: x[0].lower())
self.neoIOComboBox.addItem('By extension')
self.neoIOComboBox.setItemData(0, None)
self.neoIOComboBox.addItems([l[0] for l in iolabels])

for i, l in enumerate(iolabels):
self.neoIOComboBox.setItemData(i + 1, l[1])

def get_letter_id(self, id_, small=False):
""" Return a name consisting of letters given an integer
"""
Expand Down Expand Up @@ -503,4 +521,9 @@ def on_actionFull_Load_triggered(self):

@pyqtSignature("")
def on_actionLazy_Load_triggered(self):
NeoDataProvider.lazy_mode = 1
NeoDataProvider.lazy_mode = 1

@pyqtSignature("int")
def on_neoIOComboBox_currentIndexChanged(self, index):
if index > 0:
NeoDataProvider.forced_io = self.neoIOComboBox.itemData(index)

0 comments on commit dc1783c

Please sign in to comment.