mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-05-08 17:59:50 +00:00
Modernized signal handling/emitting in result_window and results_model.
This commit is contained in:
parent
496f29b5c3
commit
70f88ba39c
@ -6,10 +6,10 @@
|
|||||||
# which should be included with this package. The terms are also available at
|
# which should be included with this package. The terms are also available at
|
||||||
# http://www.hardcoded.net/licenses/bsd_license
|
# http://www.hardcoded.net/licenses/bsd_license
|
||||||
|
|
||||||
from PyQt4.QtCore import Qt, SIGNAL, QUrl, QRect
|
from PyQt4.QtCore import Qt, QUrl, QRect
|
||||||
from PyQt4.QtGui import (QMainWindow, QMenu, QLabel, QMessageBox, QInputDialog, QLineEdit,
|
from PyQt4.QtGui import (QMainWindow, QMenu, QLabel, QMessageBox, QInputDialog, QLineEdit,
|
||||||
QDesktopServices, QFileDialog, QMenuBar, QWidget, QVBoxLayout, QAbstractItemView, QStatusBar,
|
QDesktopServices, QFileDialog, QMenuBar, QWidget, QVBoxLayout, QAbstractItemView, QStatusBar,
|
||||||
QDialog)
|
QDialog, QAction)
|
||||||
|
|
||||||
from hscommon.plat import ISOSX, ISLINUX
|
from hscommon.plat import ISOSX, ISLINUX
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
@ -33,9 +33,9 @@ class ResultWindow(QMainWindow):
|
|||||||
self.stats = StatsLabel(app.model.stats_label, self.statusLabel)
|
self.stats = StatsLabel(app.model.stats_label, self.statusLabel)
|
||||||
self._update_column_actions_status()
|
self._update_column_actions_status()
|
||||||
|
|
||||||
self.connect(self.menuColumns, SIGNAL('triggered(QAction*)'), self.columnToggled)
|
self.menuColumns.triggered[QAction].connect(self.columnToggled)
|
||||||
self.connect(self.resultsView, SIGNAL('doubleClicked()'), self.resultsDoubleClicked)
|
self.resultsView.doubleClicked.connect(self.resultsDoubleClicked)
|
||||||
self.connect(self.resultsView, SIGNAL('spacePressed()'), self.resultsSpacePressed)
|
self.resultsView.spacePressed.connect(self.resultsSpacePressed)
|
||||||
self.app.willSavePrefs.connect(self.appWillSavePrefs)
|
self.app.willSavePrefs.connect(self.appWillSavePrefs)
|
||||||
|
|
||||||
def _setupActions(self):
|
def _setupActions(self):
|
||||||
@ -352,7 +352,7 @@ class ResultWindow(QMainWindow):
|
|||||||
def contextMenuEvent(self, event):
|
def contextMenuEvent(self, event):
|
||||||
self.actionActions.menu().exec_(event.globalPos())
|
self.actionActions.menu().exec_(event.globalPos())
|
||||||
|
|
||||||
def resultsDoubleClicked(self):
|
def resultsDoubleClicked(self, modelIndex):
|
||||||
self.app.model.open_selected()
|
self.app.model.open_selected()
|
||||||
|
|
||||||
def resultsSpacePressed(self):
|
def resultsSpacePressed(self):
|
||||||
|
@ -6,13 +6,11 @@
|
|||||||
# which should be included with this package. The terms are also available at
|
# which should be included with this package. The terms are also available at
|
||||||
# http://www.hardcoded.net/licenses/bsd_license
|
# http://www.hardcoded.net/licenses/bsd_license
|
||||||
|
|
||||||
from PyQt4.QtCore import SIGNAL, Qt, QSize
|
from PyQt4.QtCore import Qt, pyqtSignal
|
||||||
from PyQt4.QtGui import QBrush, QFont, QFontMetrics, QTableView, QColor
|
from PyQt4.QtGui import QBrush, QFont, QFontMetrics, QTableView, QColor
|
||||||
|
|
||||||
from qtlib.table import Table
|
from qtlib.table import Table
|
||||||
|
|
||||||
from core.gui.result_table import ResultTable as ResultTableModel
|
|
||||||
|
|
||||||
class ResultsModel(Table):
|
class ResultsModel(Table):
|
||||||
def __init__(self, app, view):
|
def __init__(self, app, view):
|
||||||
model = app.model.result_table
|
model = app.model.result_table
|
||||||
@ -126,11 +124,13 @@ class ResultsView(QTableView):
|
|||||||
#--- Override
|
#--- Override
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
if event.text() == ' ':
|
if event.text() == ' ':
|
||||||
self.emit(SIGNAL('spacePressed()'))
|
self.spacePressed.emit()
|
||||||
return
|
return
|
||||||
QTableView.keyPressEvent(self, event)
|
QTableView.keyPressEvent(self, event)
|
||||||
|
|
||||||
def mouseDoubleClickEvent(self, event):
|
def mouseDoubleClickEvent(self, event):
|
||||||
self.emit(SIGNAL('doubleClicked()'))
|
self.doubleClicked.emit(None)
|
||||||
# We don't call the superclass' method because the default behavior is to rename the cell.
|
# We don't call the superclass' method because the default behavior is to rename the cell.
|
||||||
|
|
||||||
|
#--- Signals
|
||||||
|
spacePressed = pyqtSignal()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user