1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-17 11:41:47 +00:00

Expert mode GUI

This commit is contained in:
Paweł Jastrzębski
2013-06-10 20:11:44 +02:00
parent e046565f22
commit 109da1056e
3 changed files with 145 additions and 24 deletions

91
KCC.ui
View File

@@ -7,19 +7,19 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>420</width> <width>420</width>
<height>345</height> <height>380</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>420</width> <width>420</width>
<height>345</height> <height>380</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>420</width> <width>420</width>
<height>345</height> <height>380</height>
</size> </size>
</property> </property>
<property name="font"> <property name="font">
@@ -426,9 +426,6 @@
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="ExpertModeButton"> <widget class="QPushButton" name="ExpertModeButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>260</x> <x>260</x>
@@ -492,7 +489,7 @@
</rect> </rect>
</property> </property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::ClickFocus</enum>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When converting color images setting this option to 1.0 &lt;span style=&quot; font-weight:600;&quot;&gt;might&lt;/span&gt; improve readability.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When converting color images setting this option to 1.0 &lt;span style=&quot; font-weight:600;&quot;&gt;might&lt;/span&gt; improve readability.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -507,6 +504,86 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
<zorder>GammaLabel</zorder>
<zorder>GammaSlider</zorder>
<zorder>OptionsExpert</zorder>
<zorder>OptionsExpert</zorder>
</widget>
<widget class="QFrame" name="OptionsExpert">
<property name="geometry">
<rect>
<x>20</x>
<y>340</y>
<width>381</width>
<height>40</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="wLabel">
<property name="toolTip">
<string>Device profile width will be overwritten by this value.</string>
</property>
<property name="text">
<string>Custom width: </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="customWidth">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Device profile width will be overwritten by this value.</string>
</property>
<property name="inputMask">
<string>0000; </string>
</property>
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="hLabel">
<property name="toolTip">
<string>Device profile height will be overwritten by this value.</string>
</property>
<property name="text">
<string>Custom height: </string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="customHeight">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Device profile height will be overwritten by this value.</string>
</property>
<property name="inputMask">
<string>0000; </string>
</property>
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</widget> </widget>
<action name="ActionBasic"> <action name="ActionBasic">

View File

@@ -36,8 +36,8 @@ from PyQt4 import QtGui, QtCore
# noinspection PyBroadException # noinspection PyBroadException
class Ui_KCC(object): class Ui_KCC(object):
def selectDir(self): def selectDir(self):
if self.firstStart: if self.needClean:
self.firstStart = False self.needClean = False
GUI.JobList.clear() GUI.JobList.clear()
dname = QtGui.QFileDialog.getExistingDirectory(MainWindow, 'Select directory', '') dname = QtGui.QFileDialog.getExistingDirectory(MainWindow, 'Select directory', '')
# Lame UTF-8 security measure # Lame UTF-8 security measure
@@ -51,8 +51,8 @@ class Ui_KCC(object):
self.clearEmptyJobs() self.clearEmptyJobs()
def selectFile(self): def selectFile(self):
if self.firstStart: if self.needClean:
self.firstStart = False self.needClean = False
GUI.JobList.clear() GUI.JobList.clear()
if self.UnRAR: if self.UnRAR:
fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Select file', '', '*.cbz *.cbr *.zip *.rar *.pdf') fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Select file', '', '*.cbz *.cbr *.zip *.rar *.pdf')
@@ -87,6 +87,7 @@ class Ui_KCC(object):
GUI.FormatBox.setEnabled(False) GUI.FormatBox.setEnabled(False)
GUI.OptionsAdvanced.setEnabled(False) GUI.OptionsAdvanced.setEnabled(False)
GUI.OptionsAdvancedGamma.setEnabled(False) GUI.OptionsAdvancedGamma.setEnabled(False)
GUI.OptionsExpert.setEnabled(False)
GUI.ProcessingBox.hide() GUI.ProcessingBox.hide()
GUI.UpscaleBox.hide() GUI.UpscaleBox.hide()
GUI.NoRotateBox.hide() GUI.NoRotateBox.hide()
@@ -97,6 +98,8 @@ class Ui_KCC(object):
GUI.StretchBox.setChecked(False) GUI.StretchBox.setChecked(False)
GUI.NoDitheringBox.setChecked(False) GUI.NoDitheringBox.setChecked(False)
GUI.GammaSlider.setValue(0) GUI.GammaSlider.setValue(0)
GUI.customWidth.setText('')
GUI.customHeight.setText('')
def modeAdvanced(self): def modeAdvanced(self):
MainWindow.setMinimumSize(QtCore.QSize(420, 345)) MainWindow.setMinimumSize(QtCore.QSize(420, 345))
@@ -111,10 +114,19 @@ class Ui_KCC(object):
GUI.NoRotateBox.show() GUI.NoRotateBox.show()
GUI.OptionsAdvancedGamma.setEnabled(True) GUI.OptionsAdvancedGamma.setEnabled(True)
GUI.OptionsAdvanced.setEnabled(True) GUI.OptionsAdvanced.setEnabled(True)
GUI.OptionsExpert.setEnabled(False)
GUI.customWidth.setText('')
GUI.customHeight.setText('')
def modeExpert(self): def modeExpert(self):
#TODO self.modeAdvanced()
pass MainWindow.setMinimumSize(QtCore.QSize(420, 380))
MainWindow.setMaximumSize(QtCore.QSize(420, 380))
MainWindow.resize(420, 380)
GUI.BasicModeButton.setStyleSheet('font-weight:Normal;')
GUI.AdvModeButton.setStyleSheet('font-weight:Normal;')
GUI.ExpertModeButton.setStyleSheet('font-weight:Bold;')
GUI.OptionsExpert.setEnabled(True)
def modeConvert(self, enable): def modeConvert(self, enable):
GUI.BasicModeButton.setEnabled(enable) GUI.BasicModeButton.setEnabled(enable)
@@ -150,12 +162,12 @@ class Ui_KCC(object):
MainWindow.repaint() MainWindow.repaint()
def convertStart(self): def convertStart(self):
if self.firstStart: if self.needClean:
self.firstStart = False self.needClean = False
GUI.JobList.clear() GUI.JobList.clear()
if GUI.JobList.count() == 0: if GUI.JobList.count() == 0:
self.addMessage('No files selected! Please choose files to convert.', self.errorIcon) self.addMessage('No files selected! Please choose files to convert.', self.errorIcon)
self.firstStart = True self.needClean = True
return return
self.modeConvert(False) self.modeConvert(False)
profile = ProfileData.ProfileLabels[str(GUI.DeviceBox.currentText())] profile = ProfileData.ProfileLabels[str(GUI.DeviceBox.currentText())]
@@ -248,7 +260,7 @@ class Ui_KCC(object):
os.remove(outputPath) os.remove(outputPath)
self.addMessage('Created EPUB file is too big for KindleGen!', self.errorIcon) self.addMessage('Created EPUB file is too big for KindleGen!', self.errorIcon)
self.addMessage('Try converting smaller batch.', self.errorIcon) self.addMessage('Try converting smaller batch.', self.errorIcon)
self.firstStart = True self.needClean = True
self.addMessage('All jobs completed.', self.warningIcon) self.addMessage('All jobs completed.', self.warningIcon)
self.modeConvert(True) self.modeConvert(True)
@@ -259,7 +271,7 @@ class Ui_KCC(object):
profiles = sorted(ProfileData.ProfileLabels.iterkeys()) profiles = sorted(ProfileData.ProfileLabels.iterkeys())
kindleIcon = QtGui.QIcon() kindleIcon = QtGui.QIcon()
kindleIcon.addPixmap(QtGui.QPixmap(":/Devices/icons/Kindle.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) kindleIcon.addPixmap(QtGui.QPixmap(":/Devices/icons/Kindle.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.firstStart = True self.needClean = True
self.GammaValue = 0 self.GammaValue = 0
self.infoIcon = QtGui.QIcon() self.infoIcon = QtGui.QIcon()
self.infoIcon.addPixmap(QtGui.QPixmap(":/Status/icons/info.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.infoIcon.addPixmap(QtGui.QPixmap(":/Status/icons/info.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

View File

@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'KCC.ui' # Form implementation generated from reading ui file 'KCC.ui'
# #
# Created: Mon Jun 10 17:51:15 2013 # Created: Mon Jun 10 20:06:36 2013
# by: PyQt4 UI code generator 4.10.1 # by: PyQt4 UI code generator 4.10.1
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@@ -26,9 +26,9 @@ except AttributeError:
class Ui_KCC(object): class Ui_KCC(object):
def setupUi(self, KCC): def setupUi(self, KCC):
KCC.setObjectName(_fromUtf8("KCC")) KCC.setObjectName(_fromUtf8("KCC"))
KCC.resize(420, 345) KCC.resize(420, 380)
KCC.setMinimumSize(QtCore.QSize(420, 345)) KCC.setMinimumSize(QtCore.QSize(420, 380))
KCC.setMaximumSize(QtCore.QSize(420, 345)) KCC.setMaximumSize(QtCore.QSize(420, 380))
font = QtGui.QFont() font = QtGui.QFont()
font.setPointSize(9) font.setPointSize(9)
KCC.setFont(font) KCC.setFont(font)
@@ -167,7 +167,6 @@ class Ui_KCC(object):
self.AdvModeButton.setFocusPolicy(QtCore.Qt.NoFocus) self.AdvModeButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.AdvModeButton.setObjectName(_fromUtf8("AdvModeButton")) self.AdvModeButton.setObjectName(_fromUtf8("AdvModeButton"))
self.ExpertModeButton = QtGui.QPushButton(self.Form) self.ExpertModeButton = QtGui.QPushButton(self.Form)
self.ExpertModeButton.setEnabled(False)
self.ExpertModeButton.setGeometry(QtCore.QRect(260, 10, 151, 32)) self.ExpertModeButton.setGeometry(QtCore.QRect(260, 10, 151, 32))
font = QtGui.QFont() font = QtGui.QFont()
font.setPointSize(9) font.setPointSize(9)
@@ -186,11 +185,36 @@ class Ui_KCC(object):
self.GammaLabel.setObjectName(_fromUtf8("GammaLabel")) self.GammaLabel.setObjectName(_fromUtf8("GammaLabel"))
self.GammaSlider = QtGui.QSlider(self.OptionsAdvancedGamma) self.GammaSlider = QtGui.QSlider(self.OptionsAdvancedGamma)
self.GammaSlider.setGeometry(QtCore.QRect(140, 10, 261, 22)) self.GammaSlider.setGeometry(QtCore.QRect(140, 10, 261, 22))
self.GammaSlider.setFocusPolicy(QtCore.Qt.NoFocus) self.GammaSlider.setFocusPolicy(QtCore.Qt.ClickFocus)
self.GammaSlider.setMaximum(500) self.GammaSlider.setMaximum(500)
self.GammaSlider.setSingleStep(5) self.GammaSlider.setSingleStep(5)
self.GammaSlider.setOrientation(QtCore.Qt.Horizontal) self.GammaSlider.setOrientation(QtCore.Qt.Horizontal)
self.GammaSlider.setObjectName(_fromUtf8("GammaSlider")) self.GammaSlider.setObjectName(_fromUtf8("GammaSlider"))
self.OptionsExpert = QtGui.QFrame(self.Form)
self.OptionsExpert.setGeometry(QtCore.QRect(20, 340, 381, 40))
self.OptionsExpert.setFrameShape(QtGui.QFrame.StyledPanel)
self.OptionsExpert.setFrameShadow(QtGui.QFrame.Raised)
self.OptionsExpert.setObjectName(_fromUtf8("OptionsExpert"))
self.gridLayout_2 = QtGui.QGridLayout(self.OptionsExpert)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.wLabel = QtGui.QLabel(self.OptionsExpert)
self.wLabel.setObjectName(_fromUtf8("wLabel"))
self.gridLayout_2.addWidget(self.wLabel, 0, 0, 1, 1)
self.customWidth = QtGui.QLineEdit(self.OptionsExpert)
self.customWidth.setFocusPolicy(QtCore.Qt.ClickFocus)
self.customWidth.setAcceptDrops(False)
self.customWidth.setMaxLength(4)
self.customWidth.setObjectName(_fromUtf8("customWidth"))
self.gridLayout_2.addWidget(self.customWidth, 0, 1, 1, 1)
self.hLabel = QtGui.QLabel(self.OptionsExpert)
self.hLabel.setObjectName(_fromUtf8("hLabel"))
self.gridLayout_2.addWidget(self.hLabel, 0, 2, 1, 1)
self.customHeight = QtGui.QLineEdit(self.OptionsExpert)
self.customHeight.setFocusPolicy(QtCore.Qt.ClickFocus)
self.customHeight.setAcceptDrops(False)
self.customHeight.setMaxLength(4)
self.customHeight.setObjectName(_fromUtf8("customHeight"))
self.gridLayout_2.addWidget(self.customHeight, 0, 3, 1, 1)
KCC.setCentralWidget(self.Form) KCC.setCentralWidget(self.Form)
self.ActionBasic = QtGui.QAction(KCC) self.ActionBasic = QtGui.QAction(KCC)
self.ActionBasic.setCheckable(True) self.ActionBasic.setCheckable(True)
@@ -241,6 +265,14 @@ class Ui_KCC(object):
self.GammaLabel.setToolTip(_translate("KCC", "When converting color images setting this option to 1.0 MIGHT improve readability.", None)) self.GammaLabel.setToolTip(_translate("KCC", "When converting color images setting this option to 1.0 MIGHT improve readability.", None))
self.GammaLabel.setText(_translate("KCC", "Gamma correction: Auto", None)) self.GammaLabel.setText(_translate("KCC", "Gamma correction: Auto", None))
self.GammaSlider.setToolTip(_translate("KCC", "<html><head/><body><p>When converting color images setting this option to 1.0 <span style=\" font-weight:600;\">might</span> improve readability.</p></body></html>", None)) self.GammaSlider.setToolTip(_translate("KCC", "<html><head/><body><p>When converting color images setting this option to 1.0 <span style=\" font-weight:600;\">might</span> improve readability.</p></body></html>", None))
self.wLabel.setToolTip(_translate("KCC", "Device profile width will be overwritten by this value.", None))
self.wLabel.setText(_translate("KCC", "Custom width: ", None))
self.customWidth.setToolTip(_translate("KCC", "Device profile width will be overwritten by this value.", None))
self.customWidth.setInputMask(_translate("KCC", "0000; ", None))
self.hLabel.setToolTip(_translate("KCC", "Device profile height will be overwritten by this value.", None))
self.hLabel.setText(_translate("KCC", "Custom height: ", None))
self.customHeight.setToolTip(_translate("KCC", "Device profile height will be overwritten by this value.", None))
self.customHeight.setInputMask(_translate("KCC", "0000; ", None))
self.ActionBasic.setText(_translate("KCC", "Basic", None)) self.ActionBasic.setText(_translate("KCC", "Basic", None))
self.ActionAdvanced.setText(_translate("KCC", "Advanced", None)) self.ActionAdvanced.setText(_translate("KCC", "Advanced", None))