Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def retranslateUi(self, Form):
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
self.roiBtn.setText(QtGui.QApplication.translate("Form", "ROI", None, QtGui.QApplication.UnicodeUTF8))
self.normBtn.setText(QtGui.QApplication.translate("Form", "Norm", None, QtGui.QApplication.UnicodeUTF8))
self.normGroup.setTitle(QtGui.QApplication.translate("Form", "Normalization", None, QtGui.QApplication.UnicodeUTF8))
self.normSubtractRadio.setText(QtGui.QApplication.translate("Form", "Subtract", None, QtGui.QApplication.UnicodeUTF8))
self.normDivideRadio.setText(QtGui.QApplication.translate("Form", "Divide", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setText(QtGui.QApplication.translate("Form", "Operation:", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("Form", "Mean:", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("Form", "Blur:", None, QtGui.QApplication.UnicodeUTF8))
self.normROICheck.setText(QtGui.QApplication.translate("Form", "ROI", None, QtGui.QApplication.UnicodeUTF8))
self.label_8.setText(QtGui.QApplication.translate("Form", "X", None, QtGui.QApplication.UnicodeUTF8))
self.label_9.setText(QtGui.QApplication.translate("Form", "Y", None, QtGui.QApplication.UnicodeUTF8))
self.label_10.setText(QtGui.QApplication.translate("Form", "T", None, QtGui.QApplication.UnicodeUTF8))
self.normOffRadio.setText(QtGui.QApplication.translate("Form", "Off", None, QtGui.QApplication.UnicodeUTF8))
self.normTimeRangeCheck.setText(QtGui.QApplication.translate("Form", "Time range", None, QtGui.QApplication.UnicodeUTF8))
self.normFrameCheck.setText(QtGui.QApplication.translate("Form", "Frame", None, QtGui.QApplication.UnicodeUTF8))
# --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# -------------------------------------------------------------------------
"""Dialog to add data sources to the GUI"""
from interface.Qt import QtGui, QtCore
from interface.ui import Ui_addBackend
class AddBackendDialog(QtGui.QDialog, Ui_addBackend):
"""Dialog to add data sources to the GUI"""
def __init__(self, parent):
QtGui.QDialog.__init__(self, parent, QtCore.Qt.WindowTitleHint)
self.setupUi(self)
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
self.roiBtn.setText(QtGui.QApplication.translate("Form", "ROI", None, QtGui.QApplication.UnicodeUTF8))
self.normBtn.setText(QtGui.QApplication.translate("Form", "Norm", None, QtGui.QApplication.UnicodeUTF8))
self.normGroup.setTitle(QtGui.QApplication.translate("Form", "Normalization", None, QtGui.QApplication.UnicodeUTF8))
self.normSubtractRadio.setText(QtGui.QApplication.translate("Form", "Subtract", None, QtGui.QApplication.UnicodeUTF8))
self.normDivideRadio.setText(QtGui.QApplication.translate("Form", "Divide", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setText(QtGui.QApplication.translate("Form", "Operation:", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("Form", "Mean:", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("Form", "Blur:", None, QtGui.QApplication.UnicodeUTF8))
self.normROICheck.setText(QtGui.QApplication.translate("Form", "ROI", None, QtGui.QApplication.UnicodeUTF8))
self.label_8.setText(QtGui.QApplication.translate("Form", "X", None, QtGui.QApplication.UnicodeUTF8))
self.label_9.setText(QtGui.QApplication.translate("Form", "Y", None, QtGui.QApplication.UnicodeUTF8))
self.label_10.setText(QtGui.QApplication.translate("Form", "T", None, QtGui.QApplication.UnicodeUTF8))
self.normOffRadio.setText(QtGui.QApplication.translate("Form", "Off", None, QtGui.QApplication.UnicodeUTF8))
self.normTimeRangeCheck.setText(QtGui.QApplication.translate("Form", "Time range", None, QtGui.QApplication.UnicodeUTF8))
self.normFrameCheck.setText(QtGui.QApplication.translate("Form", "Frame", None, QtGui.QApplication.UnicodeUTF8))
def _set_subscription(self, source, title, value):
for row in range(0,self.table.rowCount()):
if (self.table.item(row,0).text() == source.name() and
self.table.item(row,1).text() == title):
if(value):
brush = QtGui.QBrush(QtGui.QColor(230,255,230))
else:
brush = QtGui.QBrush()
for column in range(0,self.table.columnCount()):
self.table.item(row, column).setBackground(brush)
def _on_save_settings_triggered(self):
# We need a non native dialog to work around a Qt bug
# https://bugreports.qt.io/browse/QTBUG-16722
fname = QtGui.QFileDialog.getSaveFileName(self, "Save Settings", filter="Humminbird Settings (*.hum)",
options=QtGui.QFileDialog.DontUseNativeDialog)
if(fname):
self.save_settings(fname)
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = interface.ui.Ui_imageWindowSettings()
self.ui.setupUi(self)
# --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# -------------------------------------------------------------------------
"""Displays the results of the analysis to the user, using images and plots."""
from interface.Qt import QtGui, QtCore
from interface.ui import AddBackendDialog, PreferencesDialog
from interface.ui import PlotWindow, ImageWindow
from interface.ui import Ui_mainWindow
from interface.recorder import H5Recorder
from interface import DataSource
import logging
import os
class GUI(QtGui.QMainWindow, Ui_mainWindow):
"""Main Window Class.
Contains only menus and toolbars. The plots will be in their own windows.
"""
instance = None
def __init__(self, restore):
QtGui.QMainWindow.__init__(self)
self._data_windows = []
self._data_sources = []
self._recorder = None
self.settings = None
self.setupUi(self)
self.restore_settings(restore)
self._init_timer()
GUI.instance = self
def add_header(self, name, row=None):
if row is None:
row = self.table.rowCount()
self.table.insertRow(row)
named_item = QtGui.QTableWidgetItem(name)
named_item.setFlags(QtCore.Qt.NoItemFlags)
header_font = QtGui.QFont()
header_font.setBold(True)
named_item.setFont(header_font)
named_item.setData(QtCore.Qt.UserRole, str(name))
self.table.setItem(row, 1, named_item)
separator_text = ""
item = QtGui.QTableWidgetItem(separator_text)
item.setFlags(QtCore.Qt.NoItemFlags)
self.table.setItem(row, 0, item)
item = QtGui.QTableWidgetItem(separator_text)
item.setFlags(QtCore.Qt.NoItemFlags)
self.table.setItem(row, 2, item)
item = QtGui.QTableWidgetItem(separator_text)
item.setFlags(QtCore.Qt.NoItemFlags)
self.table.setItem(row, 3, item)
item = QtGui.QTableWidgetItem(separator_text)
item.setFlags(QtCore.Qt.NoItemFlags)
self.table.setItem(row, 4, item)
return named_item
def add_header(self, name, row=None):
if row is None:
row = self.table.rowCount()
self.table.insertRow(row)
named_item = QtGui.QTableWidgetItem(name)
named_item.setFlags(QtCore.Qt.NoItemFlags)
header_font = QtGui.QFont()
header_font.setBold(True)
named_item.setFont(header_font)
named_item.setData(QtCore.Qt.UserRole, str(name))
self.table.setItem(row, 1, named_item)
separator_text = ""
item = QtGui.QTableWidgetItem(separator_text)
item.setFlags(QtCore.Qt.NoItemFlags)
self.table.setItem(row, 0, item)
item = QtGui.QTableWidgetItem(separator_text)
item.setFlags(QtCore.Qt.NoItemFlags)
self.table.setItem(row, 2, item)
item = QtGui.QTableWidgetItem(separator_text)
item.setFlags(QtCore.Qt.NoItemFlags)
self.table.setItem(row, 3, item)
def add_row(self, source, plotdata, row=None):
if row is None:
row = self.table.rowCount()
self.table.insertRow(row)
item = QtGui.QTableWidgetItem(source.name())
item.setData(QtCore.Qt.UserRole, source)
item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
self.table.setItem(row, 0, item)
item = QtGui.QTableWidgetItem(plotdata.title)
item.setData(QtCore.Qt.UserRole, plotdata)
item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
self.table.setItem(row, 1, item)
bar = QtGui.QProgressBar()
self.table.setItem(row, 2, QtGui.QTableWidgetItem())
self.table.setCellWidget(row, 2, self._center_widget(bar))
checkbox = QtGui.QCheckBox()
checkbox.setChecked(plotdata.restored)
self.table.setItem(row, 3, QtGui.QTableWidgetItem())
self.table.setCellWidget(row, 3, self._center_widget(checkbox))
checkbox = QtGui.QCheckBox()
checkbox.setEnabled(plotdata.ishistory)
checkbox.setChecked(plotdata.recordhistory)
self.table.setItem(row, 4, QtGui.QTableWidgetItem())
self.table.setCellWidget(row, 4, self._center_widget(checkbox))
# Mark existing subscriptions
if(plotdata.title in source.subscribed_titles):
self._set_subscription(source, plotdata.title, True)