move media URL from model properties to deck properties

This commit is contained in:
Damien Elmes 2010-12-10 23:41:37 +09:00
parent 6580a665e9
commit 42ac12975b
4 changed files with 37 additions and 29 deletions

View file

@ -41,6 +41,7 @@ class DeckProperties(QDialog):
self.dialog.doSync.setCheckState(Qt.Checked)
else:
self.dialog.doSync.setCheckState(Qt.Unchecked)
self.dialog.mediaURL.setText(self.d.getVar("mediaURL") or "")
# priorities
self.dialog.highPriority.setText(self.d.highPriority)
self.dialog.medPriority.setText(self.d.medPriority)
@ -169,6 +170,15 @@ class DeckProperties(QDialog):
self.d.lastSync = oldSync
else:
self.d.disableSyncing()
url = unicode(self.dialog.mediaURL.text())
if url:
if not re.match("^(http|https|ftp)://", url, re.I):
url = "http://" + url
if not url.endswith("/"):
url += "/"
old = self.d.getVar("mediaURL") or ""
if old != url:
self.d.setVar("mediaURL", url)
# scheduling
minmax = ("Min", "Max")
for type in ("hard", "mid", "easy"):

View file

@ -35,7 +35,6 @@ class ModelProperties(QDialog):
def readData(self):
# properties section
self.dialog.name.setText(self.m.name)
self.dialog.mediaURL.setText(unicode(self.m.features))
# Cards
##########################################################################
@ -264,14 +263,6 @@ class ModelProperties(QDialog):
mname = _("Model")
self.updateField(self.m, 'name', mname)
self.updateField(self.m, 'tags', mname)
url = unicode(self.dialog.mediaURL.text())
if url:
if not re.match("^(http|https|ftp)://", url, re.I):
url = "http://" + url
if not url.endswith("/"):
url += "/"
self.updateField(self.m, 'features', url)
# before field, or it's overwritten
self.saveCurrentCard()
# if changed, reset deck
reset = False

View file

@ -30,14 +30,14 @@
<string>Basic</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_6">
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>&lt;b&gt;Priorities&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_21">
@ -80,7 +80,7 @@
</item>
</layout>
</item>
<item row="6" column="0">
<item row="7" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -93,7 +93,7 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>&lt;b&gt;Models&lt;/b&gt;</string>
@ -103,7 +103,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QListWidget" name="modelsList">
@ -187,6 +187,23 @@
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<property name="spacing">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Media URL</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mediaURL"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
@ -720,6 +737,7 @@
<tabstops>
<tabstop>qtabwidget</tabstop>
<tabstop>doSync</tabstop>
<tabstop>mediaURL</tabstop>
<tabstop>modelsList</tabstop>
<tabstop>modelsAdd</tabstop>
<tabstop>modelsEdit</tabstop>
@ -753,8 +771,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>266</x>
<y>539</y>
<x>275</x>
<y>442</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@ -769,8 +787,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>334</x>
<y>539</y>
<x>343</x>
<y>442</y>
</hint>
<hint type="destinationlabel">
<x>286</x>

View file

@ -41,19 +41,9 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Media URL</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mediaURL"/>
</item>
</layout>
</item>
</layout>
@ -178,7 +168,6 @@
</widget>
<tabstops>
<tabstop>name</tabstop>
<tabstop>mediaURL</tabstop>
<tabstop>cardList</tabstop>
<tabstop>cardAdd</tabstop>
<tabstop>cardRename</tabstop>