Modifiche locali in vista di una esportazione più seria

Leonardo Robol [2009-04-27 17:52]
Modifiche locali in vista di una esportazione più seria
Filename
interface.py
interface.ui
latex_manager.py
options.py
options.ui
songbook-editor.py
diff --git a/interface.py b/interface.py
index 15ddc98..35b2e5f 100644
--- a/interface.py
+++ b/interface.py
@@ -2,7 +2,7 @@

 # Form implementation generated from reading ui file 'interface.ui'
 #
-# Created: Sun Apr 26 18:50:24 2009
+# Created: Sun Apr 26 19:28:13 2009
 #      by: PyQt4 UI code generator 4.4.4
 #
 # WARNING! All changes made in this file will be lost!
@@ -123,11 +123,14 @@ class Ui_MainWindow(object):
         self.actionImporta_canzone.setObjectName("actionImporta_canzone")
         self.actionEsporta_in_LaTeX = QtGui.QAction(MainWindow)
         self.actionEsporta_in_LaTeX.setObjectName("actionEsporta_in_LaTeX")
+        self.actionOpzioni_LaTeX = QtGui.QAction(MainWindow)
+        self.actionOpzioni_LaTeX.setObjectName("actionOpzioni_LaTeX")
         self.menuFile.addAction(self.actionApri)
         self.menuFile.addAction(self.actionSalva)
         self.menuFile.addSeparator()
         self.menuFile.addAction(self.actionEsci_2)
         self.menuCanzoniere.addAction(self.actionEsporta_in_LaTeX)
+        self.menuCanzoniere.addAction(self.actionOpzioni_LaTeX)
         self.menuCanzone.addAction(self.actionSalva_canzone)
         self.menuCanzone.addAction(self.actionImporta_canzone)
         self.menubar.addAction(self.menuFile.menuAction())
@@ -139,7 +142,7 @@ class Ui_MainWindow(object):
         QtCore.QMetaObject.connectSlotsByName(MainWindow)

     def retranslateUi(self, MainWindow):
-        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "SongBook Editor 0.1", None, QtGui.QApplication.UnicodeUTF8))
+        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "SongBook Editor 0.2", None, QtGui.QApplication.UnicodeUTF8))
         self.btn_new_song.setText(QtGui.QApplication.translate("MainWindow", "Nuova Canzone", None, QtGui.QApplication.UnicodeUTF8))
         self.btn_delete_song.setText(QtGui.QApplication.translate("MainWindow", "Elimina Canzone", None, QtGui.QApplication.UnicodeUTF8))
         self.label.setText(QtGui.QApplication.translate("MainWindow", "Titolo", None, QtGui.QApplication.UnicodeUTF8))
@@ -169,4 +172,5 @@ class Ui_MainWindow(object):
         self.actionSalva_canzone.setText(QtGui.QApplication.translate("MainWindow", "Salva canzone", None, QtGui.QApplication.UnicodeUTF8))
         self.actionImporta_canzone.setText(QtGui.QApplication.translate("MainWindow", "Importa canzone", None, QtGui.QApplication.UnicodeUTF8))
         self.actionEsporta_in_LaTeX.setText(QtGui.QApplication.translate("MainWindow", "Esporta in LaTeX", None, QtGui.QApplication.UnicodeUTF8))
+        self.actionOpzioni_LaTeX.setText(QtGui.QApplication.translate("MainWindow", "Opzioni LaTeX", None, QtGui.QApplication.UnicodeUTF8))

diff --git a/interface.ui b/interface.ui
index 6448a54..0c602c2 100644
--- a/interface.ui
+++ b/interface.ui
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>SongBook Editor 0.1</string>
+   <string>SongBook Editor 0.2</string>
   </property>
   <widget class="QWidget" name="centralwidget">
    <widget class="QWidget" name="gridLayoutWidget">
@@ -192,6 +192,7 @@ p, li { white-space: pre-wrap; }
      <string>Canzoniere</string>
     </property>
     <addaction name="actionEsporta_in_LaTeX"/>
+    <addaction name="actionOpzioni_LaTeX"/>
    </widget>
    <widget class="QMenu" name="menuCanzone">
     <property name="title">
@@ -240,6 +241,11 @@ p, li { white-space: pre-wrap; }
     <string>Esporta in LaTeX</string>
    </property>
   </action>
+  <action name="actionOpzioni_LaTeX">
+   <property name="text">
+    <string>Opzioni LaTeX</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections>
diff --git a/latex_manager.py b/latex_manager.py
index eeb0441..13ed9d8 100644
--- a/latex_manager.py
+++ b/latex_manager.py
@@ -72,6 +72,8 @@ class latex_manager():

         # New buffer
         buf = unicode()
+
+        # TODO: Latex code to compile the songbook

         for song in song_list:
             buf += "\n\n" # Put some space between songs
diff --git a/options.py b/options.py
new file mode 100644
index 0000000..cc96075
--- /dev/null
+++ b/options.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'options.ui'
+#
+# Created: Sun Apr 26 19:19:25 2009
+#      by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_options(object):
+    def setupUi(self, options):
+        options.setObjectName("options")
+        options.resize(400, 266)
+        self.buttonBox = QtGui.QDialogButtonBox(options)
+        self.buttonBox.setGeometry(QtCore.QRect(30, 210, 341, 32))
+        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
+        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
+        self.buttonBox.setObjectName("buttonBox")
+        self.gridLayoutWidget = QtGui.QWidget(options)
+        self.gridLayoutWidget.setGeometry(QtCore.QRect(30, 50, 341, 141))
+        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
+        self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget)
+        self.gridLayout.setObjectName("gridLayout")
+        self.label_2 = QtGui.QLabel(self.gridLayoutWidget)
+        self.label_2.setObjectName("label_2")
+        self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)
+        self.comboBox = QtGui.QComboBox(self.gridLayoutWidget)
+        self.comboBox.setObjectName("comboBox")
+        self.comboBox.addItem(QtCore.QString())
+        self.comboBox.addItem(QtCore.QString())
+        self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
+        self.label_3 = QtGui.QLabel(self.gridLayoutWidget)
+        self.label_3.setObjectName("label_3")
+        self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1)
+        self.comboBox_2 = QtGui.QComboBox(self.gridLayoutWidget)
+        self.comboBox_2.setObjectName("comboBox_2")
+        self.comboBox_2.addItem(QtCore.QString())
+        self.comboBox_2.addItem(QtCore.QString())
+        self.comboBox_2.addItem(QtCore.QString())
+        self.gridLayout.addWidget(self.comboBox_2, 1, 1, 1, 1)
+        self.label_4 = QtGui.QLabel(self.gridLayoutWidget)
+        self.label_4.setObjectName("label_4")
+        self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1)
+        self.lineEdit = QtGui.QLineEdit(self.gridLayoutWidget)
+        self.lineEdit.setObjectName("lineEdit")
+        self.gridLayout.addWidget(self.lineEdit, 2, 1, 1, 1)
+        self.label_5 = QtGui.QLabel(self.gridLayoutWidget)
+        self.label_5.setObjectName("label_5")
+        self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1)
+        self.lineEdit_2 = QtGui.QLineEdit(self.gridLayoutWidget)
+        self.lineEdit_2.setObjectName("lineEdit_2")
+        self.gridLayout.addWidget(self.lineEdit_2, 3, 1, 1, 1)
+        self.label = QtGui.QLabel(options)
+        self.label.setGeometry(QtCore.QRect(160, 20, 141, 16))
+        self.label.setObjectName("label")
+
+        self.retranslateUi(options)
+        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), options.accept)
+        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), options.reject)
+        QtCore.QMetaObject.connectSlotsByName(options)
+
+    def retranslateUi(self, options):
+        options.setWindowTitle(QtGui.QApplication.translate("options", "Opzioni LaTeX", None, QtGui.QApplication.UnicodeUTF8))
+        self.label_2.setText(QtGui.QApplication.translate("options", "Formato", None, QtGui.QApplication.UnicodeUTF8))
+        self.comboBox.setItemText(0, QtGui.QApplication.translate("options", "A4 (290mm x 210mm)", None, QtGui.QApplication.UnicodeUTF8))
+        self.comboBox.setItemText(1, QtGui.QApplication.translate("options", "A5 (210mm x 145mm)", None, QtGui.QApplication.UnicodeUTF8))
+        self.label_3.setText(QtGui.QApplication.translate("options", "Tipo di Canzoniere", None, QtGui.QApplication.UnicodeUTF8))
+        self.comboBox_2.setItemText(0, QtGui.QApplication.translate("options", "Testo e accordi", None, QtGui.QApplication.UnicodeUTF8))
+        self.comboBox_2.setItemText(1, QtGui.QApplication.translate("options", "Solo Testo", None, QtGui.QApplication.UnicodeUTF8))
+        self.comboBox_2.setItemText(2, QtGui.QApplication.translate("options", "Slide", None, QtGui.QApplication.UnicodeUTF8))
+        self.label_4.setText(QtGui.QApplication.translate("options", "Titolo", None, QtGui.QApplication.UnicodeUTF8))
+        self.label_5.setText(QtGui.QApplication.translate("options", "Sottotitolo", None, QtGui.QApplication.UnicodeUTF8))
+        self.label.setText(QtGui.QApplication.translate("options", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Opzioni LaTex</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/options.ui b/options.ui
new file mode 100644
index 0000000..ebbb076
--- /dev/null
+++ b/options.ui
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>options</class>
+ <widget class="QDialog" name="options">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>266</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Opzioni LaTeX</string>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>210</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QWidget" name="gridLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>50</y>
+     <width>341</width>
+     <height>141</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="0" column="0">
+     <widget class="QLabel" name="label_2">
+      <property name="text">
+       <string>Formato</string>
+      </property>
+     </widget>
+    </item>
+    <item row="0" column="1">
+     <widget class="QComboBox" name="comboBox">
+      <item>
+       <property name="text">
+        <string>A4 (290mm x 210mm)</string>
+       </property>
+      </item>
+      <item>
+       <property name="text">
+        <string>A5 (210mm x 145mm)</string>
+       </property>
+      </item>
+     </widget>
+    </item>
+    <item row="1" column="0">
+     <widget class="QLabel" name="label_3">
+      <property name="text">
+       <string>Tipo di Canzoniere</string>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="1">
+     <widget class="QComboBox" name="comboBox_2">
+      <item>
+       <property name="text">
+        <string>Testo e accordi</string>
+       </property>
+      </item>
+      <item>
+       <property name="text">
+        <string>Solo Testo</string>
+       </property>
+      </item>
+      <item>
+       <property name="text">
+        <string>Slide</string>
+       </property>
+      </item>
+     </widget>
+    </item>
+    <item row="2" column="0">
+     <widget class="QLabel" name="label_4">
+      <property name="text">
+       <string>Titolo</string>
+      </property>
+     </widget>
+    </item>
+    <item row="2" column="1">
+     <widget class="QLineEdit" name="lineEdit"/>
+    </item>
+    <item row="3" column="0">
+     <widget class="QLabel" name="label_5">
+      <property name="text">
+       <string>Sottotitolo</string>
+      </property>
+     </widget>
+    </item>
+    <item row="3" column="1">
+     <widget class="QLineEdit" name="lineEdit_2"/>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>160</x>
+     <y>20</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Droid Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Opzioni LaTex&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>options</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>options</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>
diff --git a/songbook-editor.py b/songbook-editor.py
index 1a4bdf2..1436478 100755
--- a/songbook-editor.py
+++ b/songbook-editor.py
@@ -2,6 +2,7 @@

 from PyQt4 import QtGui, QtCore
 from interface import *
+from options import *
 from song import *
 from latex_manager import *
 import re, sys
@@ -12,6 +13,9 @@ class interface(QtGui.QMainWindow):
         self.ui = Ui_MainWindow()
         self.ui.setupUi(self)

+        # options dialog
+        self.opt = None
+
         # Create an empty database of songs...
         self.song_db = []

@@ -193,6 +197,19 @@ class interface(QtGui.QMainWindow):
         handle.write(sbk.encode("utf-8"))
         handle.close()

+    def options(self):
+        self.opt = option_interface()
+
+
+class option_interface(QtGui.QDialog):
+    def __init__(self, parent=None):
+        self.ui = Ui_options()
+        self.ui.setupUi(self)
+
+        self.connect(self.ui.buttonBox, QtCore.SIGNAL("accepted()"), self.accepted)
+
+        def accepted(self):
+            print "ciao"


ViewGit