1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

[#63 state:fixed] Added a "Open Debug Log" menu item in dg qt's menu.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40165
This commit is contained in:
hsoft 2009-10-02 11:12:25 +00:00
parent ff86624c3e
commit 61af22403e
5 changed files with 36 additions and 25 deletions

View File

@ -7,6 +7,8 @@
# 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/hs_license # http://www.hardcoded.net/licenses/hs_license
from __future__ import unicode_literals
import logging import logging
import os.path as op import os.path as op
@ -54,6 +56,8 @@ class DupeGuru(DupeGuruBase, QObject):
def __init__(self, data_module, appid): def __init__(self, data_module, appid):
appdata = unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)) appdata = unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
# For basicConfig() to work, we have to be sure that no logging has taken place before this call.
logging.basicConfig(filename=op.join(appdata, 'debug.log'), level=logging.WARNING)
DupeGuruBase.__init__(self, data_module, appdata, appid) DupeGuruBase.__init__(self, data_module, appdata, appid)
QObject.__init__(self) QObject.__init__(self)
self._setup() self._setup()
@ -169,6 +173,11 @@ class DupeGuru(DupeGuruBase, QObject):
self.results.mark_none() self.results.mark_none()
self.emit(SIGNAL('dupeMarkingChanged()')) self.emit(SIGNAL('dupeMarkingChanged()'))
def openDebugLog(self):
debugLogPath = op.join(self.appdata, 'debug.log')
url = QUrl.fromLocalFile(debugLogPath)
QDesktopServices.openUrl(url)
def open_selected(self): def open_selected(self):
if self.selected_dupe is None: if self.selected_dupe is None:
return return

View File

@ -1,24 +0,0 @@
#!/usr/bin/env python
# Created By: Virgil Dupras
# Created On: 2009-05-22
# $Id$
# Copyright 2009 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "HS" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/hs_license
import os
import sys
def print_and_do(cmd):
print cmd
os.system(cmd)
print_and_do("pyuic4 main_window.ui > main_window_ui.py")
print_and_do("pyuic4 directories_dialog.ui > directories_dialog_ui.py")
print_and_do("pyuic4 about_box.ui > about_box_ui.py")
print_and_do("pyuic4 reg_submit_dialog.ui > reg_submit_dialog_ui.py")
print_and_do("pyuic4 reg_demo_dialog.ui > reg_demo_dialog_ui.py")
print_and_do("pyuic4 error_report_dialog.ui > error_report_dialog_ui.py")
print_and_do("pyrcc4 dg.qrc > dg_rc.py")

View File

@ -230,6 +230,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def moveTriggered(self): def moveTriggered(self):
self.app.copy_or_move_marked(False) self.app.copy_or_move_marked(False)
def openDebugLogTriggered(self):
self.app.openDebugLog()
def openTriggered(self): def openTriggered(self):
self.app.open_selected() self.app.open_selected()

View File

@ -113,6 +113,7 @@
<addaction name="actionShowHelp"/> <addaction name="actionShowHelp"/>
<addaction name="actionRegister"/> <addaction name="actionRegister"/>
<addaction name="actionCheckForUpdate"/> <addaction name="actionCheckForUpdate"/>
<addaction name="actionOpenDebugLog"/>
<addaction name="actionAbout"/> <addaction name="actionAbout"/>
</widget> </widget>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -422,6 +423,11 @@
<string>Export To XHTML</string> <string>Export To XHTML</string>
</property> </property>
</action> </action>
<action name="actionOpenDebugLog">
<property name="text">
<string>Open Debug Log</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
@ -898,6 +904,22 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>actionOpenDebugLog</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>openDebugLogTriggered()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>314</x>
<y>256</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>directoriesTriggered()</slot> <slot>directoriesTriggered()</slot>
@ -930,5 +952,6 @@
<slot>registerTrigerred()</slot> <slot>registerTrigerred()</slot>
<slot>checkForUpdateTriggered()</slot> <slot>checkForUpdateTriggered()</slot>
<slot>exportTriggered()</slot> <slot>exportTriggered()</slot>
<slot>openDebugLogTriggered()</slot>
</slots> </slots>
</ui> </ui>

View File

@ -14,4 +14,4 @@ import sys
if sys.platform == 'win32': if sys.platform == 'win32':
from platform_win import * from platform_win import *
else: else:
logging.warning("Unsupported Platform!!") pass # unsupported platform