From 44ecae26574f051dc9ee7080f8bf1cd0347ac28f Mon Sep 17 00:00:00 2001 From: hsoft Date: Tue, 1 Sep 2009 16:40:29 +0000 Subject: [PATCH] [#14 state:fixed] Added a Export to XHTML menu to the Qt port of DG. --HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40109 --- base/qt/main_window.py | 16 +++++++++++++--- base/qt/main_window.ui | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/base/qt/main_window.py b/base/qt/main_window.py index e4218caf..a6442b9c 100644 --- a/base/qt/main_window.py +++ b/base/qt/main_window.py @@ -7,9 +7,9 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/hs_license -from PyQt4.QtCore import Qt, QCoreApplication, QProcess, SIGNAL +from PyQt4.QtCore import Qt, QCoreApplication, QProcess, SIGNAL, QUrl from PyQt4.QtGui import (QMainWindow, QMenu, QPixmap, QIcon, QToolButton, QLabel, QHeaderView, - QMessageBox, QInputDialog, QLineEdit, QItemSelectionModel) + QMessageBox, QInputDialog, QLineEdit, QItemSelectionModel, QDesktopServices) from hsutil.misc import nonone @@ -200,7 +200,17 @@ class MainWindow(QMainWindow, Ui_MainWindow): def directoriesTriggered(self): self.app.show_directories() - + + def exportTriggered(self): + h = self.resultsView.header() + column_ids = [] + for i in range(len(self.app.data.COLUMNS)): + if not h.isSectionHidden(i): + column_ids.append(str(i)) + exported_path = self.app.export_to_xhtml(column_ids) + url = QUrl.fromLocalFile(exported_path) + QDesktopServices.openUrl(url) + def makeReferenceTriggered(self): self.app.make_reference(self.resultsView.selectedDupes()) diff --git a/base/qt/main_window.ui b/base/qt/main_window.ui index 754f265c..8d949c2f 100644 --- a/base/qt/main_window.ui +++ b/base/qt/main_window.ui @@ -121,6 +121,7 @@ + @@ -416,6 +417,11 @@ Check for Update + + + Export To XHTML + + @@ -876,6 +882,22 @@ + + actionExport + triggered() + MainWindow + exportTriggered() + + + -1 + -1 + + + 314 + 256 + + + directoriesTriggered() @@ -907,5 +929,6 @@ aboutTriggered() registerTrigerred() checkForUpdateTriggered() + exportTriggered()