mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 23:57:13 -05:00
add support for media url setting in model properties
This commit is contained in:
parent
17ad85e8b8
commit
5118b4d88d
2 changed files with 219 additions and 212 deletions
|
|
@ -42,6 +42,7 @@ class ModelProperties(QDialog):
|
|||
self.dialog.tags.setText(self.m.tags)
|
||||
self.dialog.spacing.setText(str(self.m.spacing))
|
||||
self.dialog.initialSpacing.setText(str(self.m.initialSpacing/60))
|
||||
self.dialog.mediaURL.setText(str(self.m.features))
|
||||
|
||||
# Fields
|
||||
##########################################################################
|
||||
|
|
@ -468,6 +469,13 @@ order by n""", id=card.id)
|
|||
self.updateField(self.m, 'name', mname)
|
||||
self.updateField(self.m, 'tags',
|
||||
unicode(self.dialog.tags.text()))
|
||||
url = unicode(self.dialog.mediaURL.text())
|
||||
if url:
|
||||
if not re.match("^(http|ftp)://", url, re.I):
|
||||
url = "http://" + url
|
||||
if not url.endswith("/"):
|
||||
url += "/"
|
||||
self.updateField(self.m, 'features', url)
|
||||
try:
|
||||
self.updateField(self.m, 'spacing',
|
||||
float(self.dialog.spacing.text()))
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ModelProperties</class>
|
||||
<widget class="QDialog" name="ModelProperties">
|
||||
|
|
@ -8,8 +9,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>376</width>
|
||||
<height>518</height>
|
||||
<width>393</width>
|
||||
<height>551</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -22,14 +23,6 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>452</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>General && Fields</string>
|
||||
</attribute>
|
||||
|
|
@ -43,7 +36,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><h1>General</h1></string>
|
||||
<string><h1>General</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -58,7 +51,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><b>Name</b></string>
|
||||
<string><b>Name</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
|
@ -71,7 +64,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><b>Tags</b></string>
|
||||
<string><b>Tags</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
|
@ -87,7 +80,7 @@
|
|||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string><b>Minimum spacing</b></string>
|
||||
<string><b>Minimum spacing</b></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
|
|
@ -97,7 +90,7 @@
|
|||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string><b>Spacing multipler</b></string>
|
||||
<string><b>Spacing multipler</b></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
|
|
@ -118,6 +111,16 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><b>Media URL</B></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="mediaURL"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
@ -130,7 +133,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string><h1>Fields</h1></string>
|
||||
<string><h1>Fields</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -145,7 +148,7 @@
|
|||
<item>
|
||||
<widget class="QListWidget" name="fieldList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
|
@ -230,7 +233,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string><b>Options</b></string>
|
||||
<string><b>Options</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -247,7 +250,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string><b>Name</b></string>
|
||||
<string><b>Name</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
|
@ -276,14 +279,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>452</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Card Templates</string>
|
||||
</attribute>
|
||||
|
|
@ -291,7 +286,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string><h1>Card Templates</h1></string>
|
||||
<string><h1>Card Templates</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -306,7 +301,7 @@
|
|||
<item>
|
||||
<widget class="QListWidget" name="cardList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
|
|
@ -383,14 +378,14 @@
|
|||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><b>Options</b></string>
|
||||
<string><b>Options</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QTextEdit" name="cardAnswer">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
|
@ -415,7 +410,7 @@
|
|||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string><b>Answer</b></string>
|
||||
<string><b>Answer</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
|
@ -431,7 +426,7 @@
|
|||
<item row="1" column="1">
|
||||
<widget class="QTextEdit" name="cardQuestion">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
|
@ -453,7 +448,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string><b>Name</b></string>
|
||||
<string><b>Name</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
|
@ -466,7 +461,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string><b>Question</b></string>
|
||||
<string><b>Question</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
|
@ -522,6 +517,7 @@
|
|||
<tabstop>tags</tabstop>
|
||||
<tabstop>initialSpacing</tabstop>
|
||||
<tabstop>spacing</tabstop>
|
||||
<tabstop>mediaURL</tabstop>
|
||||
<tabstop>fieldList</tabstop>
|
||||
<tabstop>fieldAdd</tabstop>
|
||||
<tabstop>fieldUp</tabstop>
|
||||
|
|
@ -540,6 +536,9 @@
|
|||
<tabstop>cardName</tabstop>
|
||||
<tabstop>cardQuestion</tabstop>
|
||||
<tabstop>cardAnswer</tabstop>
|
||||
<tabstop>typeAnswer</tabstop>
|
||||
<tabstop>questionInAnswer</tabstop>
|
||||
<tabstop>allowEmptyAnswer</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue