Mkae filename pattern used to guess metadata configurable

This commit is contained in:
Kovid Goyal 2008-02-13 19:55:39 +00:00
parent dd3de8a127
commit baef59dce7
6 changed files with 616 additions and 253 deletions

View File

@ -55,12 +55,21 @@ def set_metadata(stream, mi, stream_type='lrf'):
elif stream_type == 'rtf':
set_rtf_metadata(stream, mi)
_filename_pat = re.compile(r'(?P<title>.+) - (?P<author>[^_]+)')
_filename_pat = re.compile(ur'(?P<title>.+) - (?P<author>[^_]+)')
def metadata_from_filename(name):
def get_filename_pat():
return _filename_pat.pattern
def set_filename_pat(pat):
global _filename_pat
_filename_pat = re.compile(pat)
def metadata_from_filename(name, pat=None):
name = os.path.splitext(name)[0]
mi = MetaInformation(None, None)
match = _filename_pat.search(name)
if pat is None:
pat = _filename_pat
match = pat.search(name)
if match:
try:
mi.title = match.group('title')
@ -79,6 +88,15 @@ def metadata_from_filename(name):
mi.authors = authors
except IndexError:
pass
try:
mi.series = match.group('series')
except IndexError:
pass
try:
si = match.group('series_index')
mi.series_index = int(si)
except IndexError, ValueError:
pass
if not mi.title:
mi.title = name
return mi

View File

@ -14,12 +14,13 @@
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
from PyQt4.QtGui import QDialog, QMessageBox, QListWidgetItem
from PyQt4.QtGui import QDialog, QMessageBox, QListWidgetItem, QVBoxLayout
from PyQt4.QtCore import QSettings, QVariant, SIGNAL, QStringList, QTimer, Qt
from libprs500 import islinux
from libprs500.gui2.dialogs.config_ui import Ui_Dialog
from libprs500.gui2 import qstring_to_unicode, choose_dir, error_dialog
from libprs500.gui2.widgets import FilenamePattern
class ConfigDialog(QDialog, Ui_Dialog):
@ -61,6 +62,11 @@ class ConfigDialog(QDialog, Ui_Dialog):
item.setCheckState(Qt.Unchecked)
else:
item.setCheckState(Qt.Checked)
self.mbl = QVBoxLayout()
self.metadata_box.setLayout(self.mbl)
self.filename_pattern = FilenamePattern(None)
self.mbl.addChildWidget(self.filename_pattern)
def compact(self, toggled):
@ -88,7 +94,10 @@ class ConfigDialog(QDialog, Ui_Dialog):
settings.setValue('network timeout', QVariant(self.timeout.value()))
path = qstring_to_unicode(self.location.text())
self.final_columns = [self.columns.item(i).checkState() == Qt.Checked for i in range(self.columns.count())]
pattern = self.filename_pattern.commit()
settings.setValue('filename pattern', QVariant(pattern))
if not path or not os.path.exists(path) or not os.path.isdir(path):
d = error_dialog(self, _('Invalid database location'), _('Invalid database location ')+path+_('<br>Must be a directory.'))
d.exec_()

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>451</width>
<height>507</height>
<width>667</width>
<height>630</height>
</rect>
</property>
<property name="windowTitle" >
@ -15,275 +15,360 @@
<property name="windowIcon" >
<iconset resource="../images.qrc" >:/images/config.svg</iconset>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QStackedWidget" name="stackedWidget" >
<widget class="QWidget" name="page" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QListWidget" name="listWidget" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="movement" >
<enum>QListView::Static</enum>
</property>
<property name="flow" >
<enum>QListView::TopToBottom</enum>
</property>
<property name="isWrapping" stdset="0" >
<bool>false</bool>
</property>
<property name="gridSize" >
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="viewMode" >
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes" >
<bool>true</bool>
</property>
<property name="currentRow" >
<number>0</number>
</property>
<item>
<property name="text" >
<string>Basic</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/metadata.svg</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Advanced</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/view.svg</iconset>
</property>
</item>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="page" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&amp;Location of books database (library1.db)</string>
</property>
<property name="buddy" >
<cstring>location</cstring>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLineEdit" name="location" />
</item>
<item>
<widget class="QToolButton" name="browse_button" >
<property name="toolTip" >
<string>Browse for the new database location</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/mimetypes/dir.svg</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="roman_numerals" >
<property name="text" >
<string>&amp;Location of books database (library1.db)</string>
<string>Use &amp;Roman numerals for series number</string>
</property>
<property name="buddy" >
<cstring>location</cstring>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<item row="2" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLineEdit" name="location" />
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Default network &amp;timeout:</string>
</property>
<property name="buddy" >
<cstring>timeout</cstring>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="browse_button" >
<widget class="QSpinBox" name="timeout" >
<property name="toolTip" >
<string>Browse for the new database location</string>
<string>Set the default timeout for network fetches (i.e. anytime libprs500 foes out to the internet to get information)</string>
</property>
<property name="text" >
<string>...</string>
<property name="suffix" >
<string> seconds</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/mimetypes/dir.svg</iconset>
<property name="minimum" >
<number>2</number>
</property>
<property name="maximum" >
<number>120</number>
</property>
<property name="value" >
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="roman_numerals" >
<property name="text" >
<string>Use &amp;Roman numerals for series number</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Default network &amp;timeout:</string>
</property>
<property name="buddy" >
<cstring>timeout</cstring>
</property>
</widget>
<item row="3" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>&amp;Priority for conversion jobs:</string>
</property>
<property name="buddy" >
<cstring>priority</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="priority" />
</item>
</layout>
</item>
<item>
<widget class="QSpinBox" name="timeout" >
<property name="toolTip" >
<string>Set the default timeout for network fetches (i.e. anytime libprs500 foes out to the internet to get information)</string>
<item row="6" column="0" >
<widget class="QGroupBox" name="dirs_box" >
<property name="title" >
<string>Frequently used directories</string>
</property>
<property name="suffix" >
<string> seconds</string>
</property>
<property name="minimum" >
<number>2</number>
</property>
<property name="maximum" >
<number>120</number>
</property>
<property name="value" >
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>&amp;Priority for conversion jobs:</string>
</property>
<property name="buddy" >
<cstring>priority</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="priority" />
</item>
</layout>
</item>
<item row="4" column="0" >
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="compact_button" >
<property name="toolTip" >
<string>Free unused diskspace from the database</string>
</property>
<property name="text" >
<string>&amp;Compact database</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="0" >
<widget class="QGroupBox" name="dirs_box" >
<property name="title" >
<string>Frequently used directories</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QListWidget" name="directory_list" >
<property name="alternatingRowColors" >
<bool>true</bool>
</property>
<property name="iconSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
<widget class="QListWidget" name="directory_list" >
<property name="alternatingRowColors" >
<bool>true</bool>
</property>
<property name="sizeHint" >
<property name="iconSize" >
<size>
<width>20</width>
<height>40</height>
<width>22</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="add_button" >
<property name="toolTip" >
<string>Add a directory to the frequently used directories list</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/plus.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="remove_button" >
<property name="toolTip" >
<string>Remove a directory from the frequently used directories list</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/list_remove.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<layout class="QVBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="add_button" >
<property name="toolTip" >
<string>Add a directory to the frequently used directories list</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/plus.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="remove_button" >
<property name="toolTip" >
<string>Remove a directory from the frequently used directories list</string>
</property>
<property name="text" >
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/list_remove.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="7" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>392</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Select visible &amp;columns in library view</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QListWidget" name="columns" >
<property name="selectionMode" >
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2" />
</widget>
</widget>
</item>
<item row="7" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>392</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Select visible &amp;columns in library view</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QListWidget" name="columns" >
<property name="selectionMode" >
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2" >
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="compact_button" >
<property name="toolTip" >
<string>Free unused diskspace from the database</string>
</property>
<property name="text" >
<string>&amp;Compact database</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="metadata_box" >
<property name="title" >
<string>&amp;Metadata from file name</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<item row="1" column="0" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@ -306,8 +391,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>227</x>
<y>279</y>
<x>231</x>
<y>502</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
@ -322,8 +407,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>295</x>
<y>285</y>
<x>299</x>
<y>502</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
@ -331,5 +416,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>listWidget</sender>
<signal>currentRowChanged(int)</signal>
<receiver>stackedWidget</receiver>
<slot>setCurrentIndex(int)</slot>
<hints>
<hint type="sourcelabel" >
<x>176</x>
<y>184</y>
</hint>
<hint type="destinationlabel" >
<x>294</x>
<y>9</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,182 @@
<ui version="4.0" >
<class>Form</class>
<widget class="QWidget" name="Form" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>498</width>
<height>452</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;p>Set a regular expression pattern to use when trying to guess ebook metadata from filenames. &lt;p>A &lt;a href="http://docs.python.org/lib/re-syntax.html">reference&lt;/a> on the syntax of regular expressions is available.&lt;p>Use the &lt;b>Test&lt;/b> functionality below to test you regular expression on a few sample filenames.</string>
</property>
<property name="textFormat" >
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
<property name="openExternalLinks" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Regular &amp;expression</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QLineEdit" name="re" />
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>&amp;Test</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>File &amp;name:</string>
</property>
<property name="buddy" >
<cstring>filename</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="filename" />
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="test_button" >
<property name="text" >
<string>Test</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Title:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="title" >
<property name="toolTip" >
<string>Regular expression group name (?P&lt;title>)</string>
</property>
<property name="text" >
<string>No match</string>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Authors:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="authors" >
<property name="toolTip" >
<string>Regular expression group name (?P&lt;authors>)</string>
</property>
<property name="text" >
<string>No match</string>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Series:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="series" >
<property name="toolTip" >
<string>Regular expression group name (?P&lt;series>)</string>
</property>
<property name="text" >
<string>No match</string>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Series index:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLineEdit" name="series_index" >
<property name="toolTip" >
<string>Regular expression group name (?P&lt;series_index>)</string>
</property>
<property name="text" >
<string>No match</string>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -22,7 +22,7 @@ from PyQt4.QtSvg import QSvgRenderer
from libprs500 import __version__, __appname__, islinux, sanitize_file_name
from libprs500.ptempfile import PersistentTemporaryFile
from libprs500.ebooks.metadata.meta import get_metadata
from libprs500.ebooks.metadata.meta import get_metadata, get_filename_pat, set_filename_pat
from libprs500.devices.errors import FreeSpaceError
from libprs500.devices.interface import Device
from libprs500.gui2 import APP_UID, warning_dialog, choose_files, error_dialog, \
@ -806,6 +806,7 @@ class Main(MainWindow, Ui_MainWindow):
self.database_path = qstring_to_unicode(settings.value("database path",
QVariant(QString.fromUtf8(dbpath))).toString())
set_sidebar_directories(None)
set_filename_pat(qstring_to_unicode(settings.value('filename pattern', QVariant(get_filename_pat())).toString()))
def write_settings(self):
settings = QSettings()

View File

@ -12,19 +12,71 @@
## You should have received a copy of the GNU General Public License along
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'''
Miscellanous widgets used in the GUI
Miscellaneous widgets used in the GUI
'''
import re
from PyQt4.QtGui import QListView, QIcon, QFont, QLabel, QListWidget, \
QListWidgetItem, QTextCharFormat, QApplication, \
QSyntaxHighlighter, QCursor, QColor
QSyntaxHighlighter, QCursor, QColor, QWidget
from PyQt4.QtCore import QAbstractListModel, QVariant, Qt, QSize, SIGNAL, \
QObject, QRegExp, QSettings
from libprs500.gui2.jobs import DetailView
from libprs500.gui2 import human_readable, NONE, TableView
from libprs500.gui2 import human_readable, NONE, TableView, qstring_to_unicode, error_dialog
from libprs500.gui2.filename_pattern_ui import Ui_Form
from libprs500 import fit_image, get_font_families
from libprs500.ebooks.metadata.meta import get_filename_pat, metadata_from_filename, \
set_filename_pat
class FilenamePattern(QWidget, Ui_Form):
def __init__(self, parent):
QWidget.__init__(self, parent)
self.setupUi(self)
self.connect(self.test_button, SIGNAL('clicked()'), self.do_test)
self.connect(self.re, SIGNAL('returnPressed()'), self.do_test)
self.re.setText(get_filename_pat())
def do_test(self):
try:
pat = self.pattern()
except Exception, err:
error_dialog(self, _('Invalid regular expression'),
_('Invalid regular expression: %s')%err).exec_()
return
mi = metadata_from_filename(qstring_to_unicode(self.filename.text()), pat)
if mi.title:
self.title.setText(mi.title)
else:
self.title.setText(_('No match'))
if mi.authors:
self.authors.setText(', '.join(mi.authors))
else:
self.authors.setText(_('No match'))
if mi.series:
self.series.setText(mi.series)
else:
self.series.setText(_('No match'))
if mi.series_index is not None:
self.series_index.setText(str(mi.series_index))
else:
self.series_index.setText(_('No match'))
def pattern(self):
pat = qstring_to_unicode(self.re.text())
return re.compile(pat)
def commit(self):
pat = self.pattern()
set_filename_pat(pat)
return pat.pattern
class ImageView(QLabel):