Add raw tag block viewing to GUI

git-svn-id: http://comictagger.googlecode.com/svn/trunk@65 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
beville@gmail.com 2012-11-20 04:04:58 +00:00
parent a7a8bb61d6
commit a67bdee33f
5 changed files with 163 additions and 5 deletions

View File

@ -271,8 +271,6 @@ class ComicInfoXml:
for page in pages_node:
metadata.pages.append( page.attrib )
print metadata.pages
metadata.isEmpty = False
return metadata

38
logwindow.py Normal file
View File

@ -0,0 +1,38 @@
"""
A PyQT4 dialog to a text file or log
"""
"""
Copyright 2012 Anthony Beville
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import sys
from PyQt4 import QtCore, QtGui, uic
import os
from settings import ComicTaggerSettings
class LogWindow(QtGui.QDialog):
def __init__(self, parent):
super(LogWindow, self).__init__(parent)
uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'logwindow.ui' ), self)
def setText( self, text ):
self.textEdit.setPlainText( text )

78
logwindow.ui Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dialogLog</class>
<widget class="QDialog" name="dialogLog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>556</width>
<height>287</height>
</rect>
</property>
<property name="windowTitle">
<string>Issue Identification Progress</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>dialogLog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>dialogLog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -25,6 +25,8 @@ from PyQt4.QtCore import QUrl,pyqtSignal
import locale
import platform
import os
import pprint
import json
from volumeselectionwindow import VolumeSelectionWindow
from options import MetaDataStyle
@ -37,6 +39,7 @@ from settingswindow import SettingsWindow
from settings import ComicTaggerSettings
from pagebrowser import PageBrowserWindow
from filenameparser import FileNameParser
from logwindow import LogWindow
import utils
import ctversion
@ -163,6 +166,12 @@ class TaggerWindow( QtGui.QMainWindow):
self.actionReloadCRTags.setStatusTip( 'Reload ComicRack tags' )
self.actionReloadCRTags.triggered.connect( self.reloadCRTags )
self.actionViewRawCRTags.setStatusTip( 'View raw ComicRack tag block from file' )
self.actionViewRawCRTags.triggered.connect( self.viewRawCRTags )
self.actionViewRawCBLTags.setStatusTip( 'View raw ComicBookLover tag block from file' )
self.actionViewRawCBLTags.triggered.connect( self.viewRawCBLTags )
#self.actionRepackage.setShortcut( )
self.actionRepackage.setStatusTip( 'Re-create archive as CBZ' )
self.actionRepackage.triggered.connect( self.repackageArchive )
@ -1107,4 +1116,21 @@ class TaggerWindow( QtGui.QMainWindow):
def pageBrowserClosed( self ):
self.page_browser = None
def viewRawCRTags( self ):
if self.comic_archive is not None and self.comic_archive.hasCIX():
dlg = LogWindow( self )
dlg.setText( self.comic_archive.readRawCIX() )
dlg.setWindowTitle( "Raw ComicRack Tag View" )
dlg.exec_()
def viewRawCBLTags( self ):
if self.comic_archive is not None and self.comic_archive.hasCBI():
dlg = LogWindow( self )
text = pprint.pformat( json.loads(self.comic_archive.readRawCBI()), indent=4 )
print text
dlg.setText(text )
dlg.setWindowTitle( "Raw ComicBookLover Tag View" )
dlg.exec_()

View File

@ -1035,11 +1035,19 @@
<addaction name="actionReloadCBLTags"/>
<addaction name="actionReloadCRTags"/>
</widget>
<widget class="QMenu" name="menuViewRawTags">
<property name="title">
<string>View Raw Tags</string>
</property>
<addaction name="actionViewRawCRTags"/>
<addaction name="actionViewRawCBLTags"/>
</widget>
<addaction name="actionLoad"/>
<addaction name="actionWrite_Tags"/>
<addaction name="actionRepackage"/>
<addaction name="menuReload"/>
<addaction name="menuRemove"/>
<addaction name="menuViewRawTags"/>
<addaction name="actionRepackage"/>
<addaction name="actionSettings"/>
<addaction name="actionExit"/>
</widget>
@ -1053,10 +1061,10 @@
<property name="title">
<string>Tags</string>
</property>
<addaction name="actionClearEntryForm"/>
<addaction name="actionParse_Filename"/>
<addaction name="actionSearchOnline"/>
<addaction name="actionAutoSearch"/>
<addaction name="actionClearEntryForm"/>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
@ -1191,6 +1199,16 @@
<string>Show the Page Browser to inspect the comic</string>
</property>
</action>
<action name="actionViewRawCRTags">
<property name="text">
<string>View Raw ComicRack Tags</string>
</property>
</action>
<action name="actionViewRawCBLTags">
<property name="text">
<string>View Raw ComicBookLover Tags</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>