From cf5b41564048ff1e9868d85de18b6e6996f6a8dd Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 22 Jul 2009 10:20:42 +0200 Subject: [PATCH 1/7] Added the start of a song maintenance dialog. --- openlp/plugins/songs/forms/maintenanceform.py | 133 ++++++++++ resources/forms/songmaintenance.ui | 251 ++++++++++++++++++ resources/images/author_maintenance.png | Bin 0 -> 1810 bytes resources/images/book_maintenance.png | Bin 0 -> 1906 bytes resources/images/openlp-2.qrc | 3 + resources/images/topic_maintenance.png | Bin 0 -> 2468 bytes 6 files changed, 387 insertions(+) create mode 100644 openlp/plugins/songs/forms/maintenanceform.py create mode 100644 resources/forms/songmaintenance.ui create mode 100644 resources/images/author_maintenance.png create mode 100644 resources/images/book_maintenance.png create mode 100644 resources/images/topic_maintenance.png diff --git a/openlp/plugins/songs/forms/maintenanceform.py b/openlp/plugins/songs/forms/maintenanceform.py new file mode 100644 index 000000000..efd826d63 --- /dev/null +++ b/openlp/plugins/songs/forms/maintenanceform.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/raoul/Projects/openlp/songmaintenance/resources/forms/songmaintenance.ui' +# +# Created: Wed Jul 22 10:03:53 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_SongMaintenanceDialog(object): + def setupUi(self, SongMaintenanceDialog): + SongMaintenanceDialog.setObjectName("SongMaintenanceDialog") + SongMaintenanceDialog.resize(486, 361) + self.verticalLayout = QtGui.QVBoxLayout(SongMaintenanceDialog) + self.verticalLayout.setSpacing(8) + self.verticalLayout.setMargin(8) + self.verticalLayout.setObjectName("verticalLayout") + self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog) + self.ContentWidget.setObjectName("ContentWidget") + self.horizontalLayout = QtGui.QHBoxLayout(self.ContentWidget) + self.horizontalLayout.setSpacing(8) + self.horizontalLayout.setMargin(0) + self.horizontalLayout.setObjectName("horizontalLayout") + self.TypeListWidget = QtGui.QListWidget(self.ContentWidget) + self.TypeListWidget.setMaximumSize(QtCore.QSize(150, 16777215)) + self.TypeListWidget.setProperty("showDropIndicator", QtCore.QVariant(False)) + self.TypeListWidget.setIconSize(QtCore.QSize(32, 32)) + self.TypeListWidget.setFlow(QtGui.QListView.TopToBottom) + self.TypeListWidget.setSpacing(0) + self.TypeListWidget.setViewMode(QtGui.QListView.IconMode) + self.TypeListWidget.setUniformItemSizes(True) + self.TypeListWidget.setObjectName("TypeListWidget") + #self.TypeListWidget.setColumnWidth(0, self.TypeListWidget.viewport().size().width()) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(":/songs/author_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + item = QtGui.QListWidgetItem(self.TypeListWidget) + item.setIcon(icon) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(":/songs/topic_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + item = QtGui.QListWidgetItem(self.TypeListWidget) + item.setIcon(icon1) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap(":/songs/book_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + item = QtGui.QListWidgetItem(self.TypeListWidget) + item.setIcon(icon2) + self.horizontalLayout.addWidget(self.TypeListWidget) + self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget) + self.TypeStackedWidget.setObjectName("TypeStackedWidget") + self.AuthorsPage = QtGui.QWidget() + self.AuthorsPage.setObjectName("AuthorsPage") + self.verticalLayout_2 = QtGui.QVBoxLayout(self.AuthorsPage) + self.verticalLayout_2.setSpacing(8) + self.verticalLayout_2.setMargin(0) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage) + self.AuthorsListWidget.setObjectName("AuthorsListWidget") + self.verticalLayout_2.addWidget(self.AuthorsListWidget) + self.AuthorWidget = QtGui.QWidget(self.AuthorsPage) + self.AuthorWidget.setObjectName("AuthorWidget") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.AuthorWidget) + self.horizontalLayout_2.setSpacing(8) + self.horizontalLayout_2.setMargin(0) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.AuthorAddButton = QtGui.QPushButton(self.AuthorWidget) + icon3 = QtGui.QIcon() + icon3.addPixmap(QtGui.QPixmap(":/songs/song_author_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AuthorAddButton.setIcon(icon3) + self.AuthorAddButton.setObjectName("AuthorAddButton") + self.horizontalLayout_2.addWidget(self.AuthorAddButton) + self.AuthorEditButton = QtGui.QPushButton(self.AuthorWidget) + icon4 = QtGui.QIcon() + icon4.addPixmap(QtGui.QPixmap(":/songs/song_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AuthorEditButton.setIcon(icon4) + self.AuthorEditButton.setObjectName("AuthorEditButton") + self.horizontalLayout_2.addWidget(self.AuthorEditButton) + self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorWidget) + icon5 = QtGui.QIcon() + icon5.addPixmap(QtGui.QPixmap(":/songs/song_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AuthorDeleteButton.setIcon(icon5) + self.AuthorDeleteButton.setObjectName("AuthorDeleteButton") + self.horizontalLayout_2.addWidget(self.AuthorDeleteButton) + self.verticalLayout_2.addWidget(self.AuthorWidget) + self.TypeStackedWidget.addWidget(self.AuthorsPage) + self.TopicsPage = QtGui.QWidget() + self.TopicsPage.setObjectName("TopicsPage") + self.TypeStackedWidget.addWidget(self.TopicsPage) + self.BooksPage = QtGui.QWidget() + self.BooksPage.setObjectName("BooksPage") + self.listWidget = QtGui.QListWidget(self.BooksPage) + self.listWidget.setGeometry(QtCore.QRect(30, 20, 256, 192)) + self.listWidget.setObjectName("listWidget") + self.TypeStackedWidget.addWidget(self.BooksPage) + self.horizontalLayout.addWidget(self.TypeStackedWidget) + self.verticalLayout.addWidget(self.ContentWidget) + self.MaintenanceButtonBox = QtGui.QDialogButtonBox(SongMaintenanceDialog) + self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal) + self.MaintenanceButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) + self.MaintenanceButtonBox.setObjectName("MaintenanceButtonBox") + self.verticalLayout.addWidget(self.MaintenanceButtonBox) + + self.retranslateUi(SongMaintenanceDialog) + self.TypeStackedWidget.setCurrentIndex(0) + QtCore.QObject.connect(self.MaintenanceButtonBox, QtCore.SIGNAL("rejected()"), SongMaintenanceDialog.accept) + QtCore.QObject.connect(self.TypeListWidget, QtCore.SIGNAL("currentRowChanged(int)"), self.TypeStackedWidget.setCurrentIndex) + QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) + + def retranslateUi(self, SongMaintenanceDialog): + SongMaintenanceDialog.setWindowTitle(QtGui.QApplication.translate("SongMaintenanceDialog", "Song Maintenance", None, QtGui.QApplication.UnicodeUTF8)) + __sortingEnabled = self.TypeListWidget.isSortingEnabled() + self.TypeListWidget.setSortingEnabled(False) + self.TypeListWidget.item(0).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Authors", None, QtGui.QApplication.UnicodeUTF8)) + self.TypeListWidget.item(1).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Topics", None, QtGui.QApplication.UnicodeUTF8)) + self.TypeListWidget.item(2).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Books/Hymnals", None, QtGui.QApplication.UnicodeUTF8)) + self.TypeListWidget.setSortingEnabled(__sortingEnabled) + self.AuthorAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) + self.AuthorEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) + self.AuthorDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) + +from openlp.core.resources import * + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + SongMaintenanceDialog = QtGui.QDialog() + ui = Ui_SongMaintenanceDialog() + ui.setupUi(SongMaintenanceDialog) + SongMaintenanceDialog.show() + sys.exit(app.exec_()) + diff --git a/resources/forms/songmaintenance.ui b/resources/forms/songmaintenance.ui new file mode 100644 index 000000000..444e444ec --- /dev/null +++ b/resources/forms/songmaintenance.ui @@ -0,0 +1,251 @@ + + + SongMaintenanceDialog + + + + 0 + 0 + 486 + 361 + + + + Song Maintenance + + + + 8 + + + 8 + + + + + + 8 + + + 0 + + + + + + 150 + 16777215 + + + + false + + + + 32 + 32 + + + + QListView::TopToBottom + + + 0 + + + QListView::IconMode + + + true + + + + Authors + + + AlignHCenter|AlignVCenter|AlignCenter + + + + :/songs/author_maintenance.png:/songs/author_maintenance.png + + + ItemIsSelectable|ItemIsEnabled + + + + + Topics + + + AlignHCenter|AlignVCenter|AlignCenter + + + + :/songs/topic_maintenance.png:/songs/topic_maintenance.png + + + ItemIsSelectable|ItemIsEnabled + + + + + Books/Hymnals + + + AlignHCenter|AlignVCenter|AlignCenter + + + + :/songs/book_maintenance.png:/songs/book_maintenance.png + + + ItemIsSelectable|ItemIsEnabled + + + + + + + + 0 + + + + + 8 + + + 0 + + + + + + + + + 8 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Add + + + + :/songs/song_author_edit.png:/songs/song_author_edit.png + + + + + + + Edit + + + + :/songs/song_edit.png:/songs/song_edit.png + + + + + + + Delete + + + + :/songs/song_delete.png:/songs/song_delete.png + + + + + + + + + + + + + + 30 + 20 + 256 + 192 + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + + + MaintenanceButtonBox + accepted() + SongMaintenanceDialog + accept() + + + 242 + 340 + + + 242 + 180 + + + + + TypeListWidget + currentRowChanged(int) + TypeStackedWidget + setCurrentIndex(int) + + + 82 + 163 + + + 321 + 163 + + + + + diff --git a/resources/images/author_maintenance.png b/resources/images/author_maintenance.png new file mode 100644 index 0000000000000000000000000000000000000000..9a1f551591b49dfc5a26094d7a5ce462856f93c2 GIT binary patch literal 1810 zcmV+t2krQYP)-zF_X((qItbe2cR{zavT3;rz9e7v?YiPXye% zqrFGxr4#MU?#qf0@(u$C5uA&s-Z+=~EtY}e3xpHv1+LRRsZ!Kw92>ghpdJLz?A_kE z9m}9#1zvgX$7C)w{~bce{zxPZ`q1l zx9vptjr}GqlTs<9IeB;=9X^8lpXo(!riYw z|FZ{19{ZJp8kC_s5{=>q-+c@N16#oYF%YWa&U;3XN+xmQ#L0#=bs(KgjGCr73QD1A z65Mg%SQelHf{T%Iq4Yfff4n|?dq$cmb^c$Ls%8? zY973jg)j@aIx#Mvc>0&gRSUTA>Y?5(0~_N&4Ov@+0HlP+S8iC}D7n1>OK7^|iPL6b z@uaj$u7I2`!YO5O^!Q6ea?V#Rz=*^q!jW(ZQos+$YrC)k$$eh~x;7r|>AQr_kVqx2 z6f;RkuM6coCO;WRa%Ktv$)l?l&^NT76Jh@p+=g_jAYNf^LAv4Zb{U$k{k&^n1fQj& zv#Z&Jiqz~3=F%CgYwLpISO^ldtZ4`v>!U|Z%Y5ARaDWqeZ3qd0ur05(2}M(m!)0u2 ztkE!xq4oC1?Gc^qq`~L|4G|53*Moo{mn%V+4*GBY+LJ%}#pAaYjrfG*&YMGb3@@xW zgwbvLBpHjnW+ z^K9y!L$@&_dV~^66h(nl1E5}qT(OV<4aWSrNsWI54L~71i^OySjlF|_VnnGC`|JFv z!*Plg*mlppoQ%Y+iF6eoPb6{4jRo7ljT<-3Q$73;QFS5&hliA22v9u)q6Z-TnXxf5 zJp)TJR4oTnSI)yjat^8*bs%*2iUJbj?0%X!xR)2(eTlkfB3n=yY9D1xo=quCMVO>s1pzpV1TPT$Z;6kD_|0%TM zGzgI(OobF2j#=@2ubLK`J33)(xD7@igv5vM$a+njPc8D_To>^6sSEpCTk8JYP!|pu zy6P5Ypp*dqn?Nq}_sO$>3*Q3o#|hI@(K)lyCu?Cc@GwG{b@XKADjeXwiSeET~KvP+5 z@Rmo`R>u+7J2#ikXWTfm<_D8!55E>>R2k~+X&GKuAHF3V(tBJnb(9cINH8G;@jV9M zYLpV!hTC28w#}zYW%K+eSLaS;7E5D_sU;5_*!}sRjE)?AkJ#MQxp1OV%82doh>%hx z0QCw}5Qj2aR2VC`TJplOtC>_#96UILFZn$D7t@xWtlnb?Q~&?~07*qoM6N<$f@PCh A4gdfE literal 0 HcmV?d00001 diff --git a/resources/images/book_maintenance.png b/resources/images/book_maintenance.png new file mode 100644 index 0000000000000000000000000000000000000000..062249fe9e7466800ec33979bfa250652cae1756 GIT binary patch literal 1906 zcmV-&2aWiNP)XQ`Z??`{*uNci9fu*kB+r<`S2dlqQAJkdRK& zmg$YWWYXt8^k4KTZ)yA5Jhcx^A9@{Tn$T&dBn)+NfsimT0b_i@vMn7Q9Z5%*bIW2| z$6!g8JCko_&E98pw7+%Mx4!R4!gXDInGiyNp%8-b5q=^#tsr;y$dO~CV`B#|UcC65 z4{W!99w7%>Bi6A2h) zglh@Zu6_ik)dU#nSI$AZbses0%4=Iq~qA2kBd}ubC zXfzs713{JwAU4BPi%5R+6ufBVR}kL254|EI+`zYeI042^1cFQ&CIMLvlXA9NEtJC% zDW^l&?gq3gSCIMcc^cwXkeFmA_`O~cBZh&O{~rPtjZ$M$v`I(>ssjTX$qA20?ZF(@ z{`^NINg(~b^ROY{fN&w`Y#+qO}3T*=J#(2<~U`QLc-{_kP)$%lV(0jZbI z0^#tM`x363OaQ5!2)M)pD&SB7NkIC5D&&O%yIo(dU7pbI-a+mDeKb`Sv7^WE%v*0G zdgLfvo?~wq(f6W)Z}cVLGPtbOYPG887q1f@D!#4KdPJUDm3SNrzxyrnfBP#;!$9iA zmykRE0|a)DAh1z}Q=LBaqdSU*VN|F|#Rs2cCp@7+UnZVm&J zhmf3}MusJ+KYWNipWK{6K~n%Yy%g|5qYxFZ75z+15~zp59kO@t9TN1eEysa&`!g*4 z;eC$iTL=yhV`}>NBmnl-(yvgpdx3;Qm&C-qQ(j&^g ziA?*Q(CVi^ozPeYuN9>Nm0)Q5CnuC-5=~9(YC#XJdL7REgXj^yIlE2RJqrpnqIWG7 z(EI@!O~7u$+k1(E&+I~@RO(9ZkxReub?klZJK{tpeQu``n8Z320KEXt0SOg=-OGIL z##MON2((XcNmAbDk>Nq4*ox8JyU`*!^}jP{EiN5nY31455paox`eVr)XLA@;ScZEL zn2;ZLkLB>l2PiOkKy?e`cV6{y7AbrXePoLUzJ-1RP?XFCm)* zd~Fi440H6vxMO!ESJ)|mOa_s$G337bHH6Y>SX6NB+BJ5-C+rSu^Zv9@CICACpxKLn zl!g+mb2ZriajxKR14$r8AJ{D$qC;n*#;w zAkY;mQD?-#U?)fwTqbc^TMtbiI)wc{{1F@yEwJD7EJKU3i*1Hg$aP~=0%HJf^&_AY zH4;E56p{*X4=qRq+$V>PeCrIxUVTOO`tA4LLv3lXJ88!nASQ%3wG#n@sIUZb5_&!; z1V{jYLP7`m*2^6`iaZVGkHw%b_DL=X`bV@&%(@=;Izd72Xb@%A-RlC00^tA{fBg+a z>H67s--XRXmalxgrT;}VDu18|mJTEh4l$Shkx+azqB!KupzR1)#2P1{M?k7jz^_)B}Fh6lP&1btW_p69Y^k6D&mVL5anEG2p;^whcjq2%zgx1 z;tnAR(1a2p${H9QMU_O7=U&4~s|k$>6`E1R<1h(}V|VD_K|Fu_I0m?Ajl`RSdwa? zfLgJL{LBpU3k!C+RH_$OSM`;J1x>HlHPtZGJG%Z(ze(r~qr%Y8kapq1g&hAK$wXl) z5C`C6cNCVF@!&Duep{iQd1(@0Cn*4nV%0pwdpzBCIyt$ALc4 skARQMej-b#gih4k2~5xQU-s|)7xQJ@X3;fT;s5{u07*qoM6N<$f=qOOfB*mh literal 0 HcmV?d00001 diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 14f05e56e..de5da6a9f 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -1,5 +1,8 @@ + book_maintenance.png + author_maintenance.png + topic_maintenance.png song_delete.png song_edit.png song_export.png diff --git a/resources/images/topic_maintenance.png b/resources/images/topic_maintenance.png new file mode 100644 index 0000000000000000000000000000000000000000..e3b8555dd99ef5de2097c4fa5134630d260c9b06 GIT binary patch literal 2468 zcmV;V30wAwP)y{D4^00|aJL_t(|+NG6wY+Th9#=m>-d-G;< z#>Vk(Cvm)BXLlfBDUdd8Aw}$gCJ7&nihWj4E zeb4?4`H=!J01flz;&9Iqr23-ph=i+)%WLy%B1M5ppWmD%U1i5cl70OrV{OrijzMVZ z)?A2XHFX#rNdk<)nH0Eky@fyC`6jYqIFH|~{}m3LJBd^x4JV{GjZCiu!{2 zx-k(~Ou~U87sM1eBh<@$`(Y5l&SMp4jg5})pDc*SIcp2 z*fLGbBFZlh76uB;t55e1q*nj3`m^U_JLJBKw@}gG$6r@Ji5s1paI*6RJPc$LAXJ75 zu<_C-P`-01LwcCH8xG#w@T1ueS(VI+CC3#PTo22^8Hh3c!vGL4_2jN}wJ9m{tNp=p z8F}#F2i-mFUu*}$v++{Po%r>h>+xk}EO!DIHZ)?u8O2i{ZAEOKA9b_pONy`K8v=EF zelneu#FcPKk)D}3kj!ODuLu&Jpmzi<(tB>Zt~4Sdkc`_!#fiDQte(8d_ES-$Qvwi# zj?YfzNWhTTH}(N)t7};(Uy(oLzlxQ!m2r2HOftAl4j2=R3kJp+yb7k*Kt>#yHG_r} zapHhciA!aXb4h&R@XkKh$M$}Bl5YRrT4-_@;J`iO_oMkwf2N57p#0$rRyuwX%r&G- zu23LwFMi3OePrr1q{TdWhR8FZ3z2dy>1W02;>7LUJBffNp8h*p5_@tRAO#HBBZw{} zya(_H?^{-p_5yV!q>^xzf)E^BOL!)DwgCbWK@q@oH6V0l9-^bHb9C_XHD^iCttWz}d6`uQ7ogeNC4`xdzKGbh5|PL9}}7B4Iz**!8sVTrlwb(NI^;k9}I-JAA<2r zdJ}2YSMnc*`R{|xN!L=lIy*xGjALWdBdEQ%jJcCUEa5vG0Ko`&!!i=WyMdV_$V~6O zvJFVdAh|ZF3=lv{NZ}@x>-395!AIx8y1>BWWe;Gjb8~J3k`z`v(M5OiH{-&<53IwO+>5a%>fC8 zX*ja*BAY+E6m{n=qU-4sEa}-iOP~)hG;y0hi@Yz@toYY@4+gfyO4*eIiAR=K23wdXal; z{t|OOxlEac$qjA*1h{ZAw?ipHib(G`Or|lI@(003I&o}dSE#x7+2ybrO&lnF55BG; z%&SNY=oKLupk5j z7XV{`lmy2Hpg4ts217#O^iK8rfr~%hTYqhe?LOOq(<}BN->N|K)@?H<00M^FlW3p& z8b%u$X~-Eu1lH!NOXLlW*MwG?c0l-Lfz zW4HoV&_}l}U4xybVMA6D+?=Fj{{2Y}?EBlZio<30N3Oon@a0&9f)&y*P@df0c=9hev*11br=I7;c@!XM2wvinRg@#1)L4n2p^Vj-Y#29KT)nI2t3D=-(ebhCblj z5yeXHCCK>V9T(D- zcxC&m-_3wWVPOG?Xxf0`8RCpn+D@}%GD)^=!!QhTrTo7Er4*{G=Rot_4U9!&-cb-V zO5v+Oz&|Mj7p7sV;^JZ!4u{dz)rH~VVFKVlQpbj3HB`vvS|eZ0pqbp|B!6n z`qKJvIB$z#n&|I8qqG68!PwZ?y=`r6n}je->E#b7Ey~unF(9U7PRW;D4I%tG>hZd| z+Pj;UEqfr6Uyw1dfB*hRT3T8*nWj0*aU6RpiSw%`S4+-x3z!z4YUtOp&ab+;PfuIg z)!FraV?#rt#BWvU&q42@Lx(<{9B6?I2D?NY%?PN(TTo*alb-Q_5Tb0000 Date: Thu, 23 Jul 2009 22:20:49 +0200 Subject: [PATCH 2/7] The new song maintenance dialog... getting there. --- openlp/core/lib/rendermanager.py | 5 +- openlp/plugins/songs/forms/__init__.py | 1 + .../songs/forms/songmaintenancedialog.py | 251 ++++++++++++++ .../songs/forms/songmaintenanceform.py | 181 +++++++++++ openlp/plugins/songs/lib/mediaitem.py | 35 +- resources/forms/songmaintenance.ui | 307 +++++++++++++++--- resources/images/author_add.png | Bin 0 -> 836 bytes resources/images/author_delete.png | Bin 0 -> 858 bytes resources/images/author_edit.png | Bin 0 -> 885 bytes resources/images/book_add.png | Bin 0 -> 670 bytes resources/images/book_delete.png | Bin 0 -> 744 bytes resources/images/book_edit.png | Bin 0 -> 776 bytes resources/images/book_maintenance.png | Bin 1906 -> 1722 bytes resources/images/openlp-2.qrc | 9 + resources/images/topic_add.png | Bin 0 -> 1007 bytes resources/images/topic_delete.png | Bin 0 -> 1038 bytes resources/images/topic_edit.png | Bin 0 -> 1024 bytes 17 files changed, 723 insertions(+), 66 deletions(-) create mode 100644 openlp/plugins/songs/forms/songmaintenancedialog.py create mode 100644 openlp/plugins/songs/forms/songmaintenanceform.py create mode 100644 resources/images/author_add.png create mode 100644 resources/images/author_delete.png create mode 100644 resources/images/author_edit.png create mode 100644 resources/images/book_add.png create mode 100644 resources/images/book_delete.png create mode 100644 resources/images/book_edit.png create mode 100644 resources/images/topic_add.png create mode 100644 resources/images/topic_delete.png create mode 100644 resources/images/topic_edit.png diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index 3efc03858..6cb117b2b 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -53,7 +53,10 @@ class RenderManager(object): self.screen_list = screen_list self.theme_manager = theme_manager self.displays = len(screen_list) - self.current_display = screen_number + if (screen_number + 1) > len(screen_list): + self.current_display = 0 + else: + self.current_display = screen_number self.renderer = Renderer() self.calculate_default(self.screen_list[self.current_display][u'size']) self.theme = u'' diff --git a/openlp/plugins/songs/forms/__init__.py b/openlp/plugins/songs/forms/__init__.py index 26b623778..4bc392b81 100644 --- a/openlp/plugins/songs/forms/__init__.py +++ b/openlp/plugins/songs/forms/__init__.py @@ -23,6 +23,7 @@ from topicsform import TopicsForm from songbookform import SongBookForm from editverseform import EditVerseForm from editsongform import EditSongForm +from songmaintenanceform import SongMaintenanceForm from openlpexportform import OpenLPExportForm from openlpimportform import OpenLPImportForm diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py new file mode 100644 index 000000000..e91ce735c --- /dev/null +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -0,0 +1,251 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 +""" +OpenLP - Open Source Lyrics Projection +Copyright (c) 2008 Raoul Snyman +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +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., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA +""" +from PyQt4 import QtCore, QtGui +from openlp.core.lib import translate + +class Ui_SongMaintenanceDialog(object): + def setupUi(self, SongMaintenanceDialog): + SongMaintenanceDialog.setObjectName("SongMaintenanceDialog") + SongMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal) + SongMaintenanceDialog.resize(486, 361) + self.DialogLayout = QtGui.QVBoxLayout(SongMaintenanceDialog) + self.DialogLayout.setSpacing(8) + self.DialogLayout.setMargin(8) + self.DialogLayout.setObjectName("DialogLayout") + self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog) + self.ContentWidget.setObjectName("ContentWidget") + self.ContentLayout = QtGui.QHBoxLayout(self.ContentWidget) + self.ContentLayout.setSpacing(8) + self.ContentLayout.setMargin(0) + self.ContentLayout.setObjectName("ContentLayout") + self.TypeListWidget = QtGui.QListWidget(self.ContentWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.TypeListWidget.sizePolicy().hasHeightForWidth()) + self.TypeListWidget.setSizePolicy(sizePolicy) + self.TypeListWidget.setProperty("showDropIndicator", QtCore.QVariant(False)) + #self.TypeListWidget.setFlow(QtGui.QListView.TopToBottom) + self.TypeListWidget.setSpacing(0) + self.TypeListWidget.setViewMode(QtGui.QListView.IconMode) + self.TypeListWidget.setIconSize(QtCore.QSize(128, 100)); + self.TypeListWidget.setMovement(QtGui.QListView.Static); + self.TypeListWidget.setMaximumWidth(128); + self.TypeListWidget.setSpacing(3); + self.TypeListWidget.setUniformItemSizes(True) + self.TypeListWidget.setObjectName("TypeListWidget") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(":/songs/author_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + item = QtGui.QListWidgetItem(self.TypeListWidget) + item.setIcon(icon) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(":/songs/topic_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + item = QtGui.QListWidgetItem(self.TypeListWidget) + item.setIcon(icon1) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap(":/songs/book_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + item = QtGui.QListWidgetItem(self.TypeListWidget) + item.setIcon(icon2) + self.ContentLayout.addWidget(self.TypeListWidget) + self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget) + self.TypeStackedWidget.setObjectName("TypeStackedWidget") + self.AuthorsPage = QtGui.QWidget() + self.AuthorsPage.setObjectName("AuthorsPage") + self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsPage) + self.AuthorsLayout.setSpacing(8) + self.AuthorsLayout.setMargin(0) + self.AuthorsLayout.setObjectName("AuthorsLayout") + self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage) + self.AuthorsListWidget.setObjectName("AuthorsListWidget") + self.AuthorsLayout.addWidget(self.AuthorsListWidget) + self.AuthorsErrorLabel = QtGui.QLabel(self.AuthorsPage) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.AuthorsErrorLabel.sizePolicy().hasHeightForWidth()) + self.AuthorsErrorLabel.setSizePolicy(sizePolicy) + self.AuthorsErrorLabel.setSize(QtCore.QSize(0, 0)) + self.AuthorsErrorLabel.setMargin(4) + self.AuthorsErrorLabel.setStyleSheet(u'background-color: #900; color: #fff;') + self.AuthorsErrorLabel.setObjectName("AuthorsErrorLabel") + self.AuthorsLayout.addWidget(self.AuthorsErrorLabel) + self.AuthorButtonWidget = QtGui.QWidget(self.AuthorsPage) + self.AuthorButtonWidget.setObjectName("AuthorButtonWidget") + self.AuthorButtonsLayout = QtGui.QHBoxLayout(self.AuthorButtonWidget) + self.AuthorButtonsLayout.setSpacing(8) + self.AuthorButtonsLayout.setMargin(0) + self.AuthorButtonsLayout.setObjectName("AuthorButtonsLayout") + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.AuthorButtonsLayout.addItem(spacerItem) + self.AuthorAddButton = QtGui.QPushButton(self.AuthorButtonWidget) + icon3 = QtGui.QIcon() + icon3.addPixmap(QtGui.QPixmap(":/songs/author_add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AuthorAddButton.setIcon(icon3) + self.AuthorAddButton.setObjectName("AuthorAddButton") + self.AuthorButtonsLayout.addWidget(self.AuthorAddButton) + self.AuthorEditButton = QtGui.QPushButton(self.AuthorButtonWidget) + icon4 = QtGui.QIcon() + icon4.addPixmap(QtGui.QPixmap(":/songs/author_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AuthorEditButton.setIcon(icon4) + self.AuthorEditButton.setObjectName("AuthorEditButton") + self.AuthorButtonsLayout.addWidget(self.AuthorEditButton) + self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorButtonWidget) + icon5 = QtGui.QIcon() + icon5.addPixmap(QtGui.QPixmap(":/songs/author_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AuthorDeleteButton.setIcon(icon5) + self.AuthorDeleteButton.setObjectName("AuthorDeleteButton") + self.AuthorButtonsLayout.addWidget(self.AuthorDeleteButton) + self.AuthorsLayout.addWidget(self.AuthorButtonWidget) + self.AuthorsLine = QtGui.QFrame(self.AuthorsPage) + self.AuthorsLine.setFrameShape(QtGui.QFrame.HLine) + self.AuthorsLine.setFrameShadow(QtGui.QFrame.Sunken) + self.AuthorsLine.setObjectName("AuthorsLine") + self.AuthorsLayout.addWidget(self.AuthorsLine) + self.TypeStackedWidget.addWidget(self.AuthorsPage) + self.TopicsPage = QtGui.QWidget() + self.TopicsPage.setObjectName("TopicsPage") + self.TopicLayout = QtGui.QVBoxLayout(self.TopicsPage) + self.TopicLayout.setSpacing(4) + self.TopicLayout.setMargin(0) + self.TopicLayout.setObjectName("TopicLayout") + self.TopicsListWidget = QtGui.QListWidget(self.TopicsPage) + self.TopicsListWidget.setObjectName("TopicsListWidget") + self.TopicLayout.addWidget(self.TopicsListWidget) + self.TopicsErrorLabel = QtGui.QLabel(self.TopicsPage) + self.TopicsErrorLabel.setMaximumHeight(0) + self.TopicsErrorLabel.setMinimumHeight(0) + self.TopicsErrorLabel.setIndent(4) + self.TopicsErrorLabel.setStyleSheet(u'background-color: #900; color: #fff;') + self.TopicsErrorLabel.setObjectName("TopicsErrorLabel") + self.TopicLayout.addWidget(self.TopicsErrorLabel) + self.TopicButtonWidget = QtGui.QWidget(self.TopicsPage) + self.TopicButtonWidget.setObjectName("TopicButtonWidget") + self.TopicButtonLayout = QtGui.QHBoxLayout(self.TopicButtonWidget) + self.TopicButtonLayout.setSpacing(8) + self.TopicButtonLayout.setMargin(0) + self.TopicButtonLayout.setObjectName("TopicButtonLayout") + spacerItem1 = QtGui.QSpacerItem(54, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.TopicButtonLayout.addItem(spacerItem1) + self.TopicAddButton = QtGui.QPushButton(self.TopicButtonWidget) + icon6 = QtGui.QIcon() + icon6.addPixmap(QtGui.QPixmap(":/songs/topic_add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.TopicAddButton.setIcon(icon6) + self.TopicAddButton.setObjectName("TopicAddButton") + self.TopicButtonLayout.addWidget(self.TopicAddButton) + self.TopicEditButton = QtGui.QPushButton(self.TopicButtonWidget) + icon7 = QtGui.QIcon() + icon7.addPixmap(QtGui.QPixmap(":/songs/topic_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.TopicEditButton.setIcon(icon7) + self.TopicEditButton.setObjectName("TopicEditButton") + self.TopicButtonLayout.addWidget(self.TopicEditButton) + self.TopicDeleteButton = QtGui.QPushButton(self.TopicButtonWidget) + icon8 = QtGui.QIcon() + icon8.addPixmap(QtGui.QPixmap(":/songs/topic_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.TopicDeleteButton.setIcon(icon8) + self.TopicDeleteButton.setObjectName("TopicDeleteButton") + self.TopicButtonLayout.addWidget(self.TopicDeleteButton) + self.TopicLayout.addWidget(self.TopicButtonWidget) + self.TopicsLine = QtGui.QFrame(self.TopicsPage) + self.TopicsLine.setFrameShape(QtGui.QFrame.HLine) + self.TopicsLine.setFrameShadow(QtGui.QFrame.Sunken) + self.TopicsLine.setObjectName("TopicsLine") + self.TopicLayout.addWidget(self.TopicsLine) + self.TypeStackedWidget.addWidget(self.TopicsPage) + self.BooksPage = QtGui.QWidget() + self.BooksPage.setObjectName("BooksPage") + self.BookLayout = QtGui.QVBoxLayout(self.BooksPage) + self.BookLayout.setSpacing(4) + self.BookLayout.setMargin(0) + self.BookLayout.setObjectName("BookLayout") + self.BooksListWidget = QtGui.QListWidget(self.BooksPage) + self.BooksListWidget.setObjectName("BooksListWidget") + self.BookLayout.addWidget(self.BooksListWidget) + self.BooksErrorLabel = QtGui.QLabel(self.BooksPage) + self.BooksErrorLabel.setMaximumHeight(0) + self.BooksErrorLabel.setMinimumHeight(0) + self.BooksErrorLabel.setIndent(4) + self.BooksErrorLabel.setStyleSheet(u'background-color: #900; color: #fff;') + self.BooksErrorLabel.setObjectName("BooksErrorLabel") + self.BookLayout.addWidget(self.BooksErrorLabel) + self.BookButtonWidget = QtGui.QWidget(self.BooksPage) + self.BookButtonWidget.setObjectName("BookButtonWidget") + self.BookButtonLayout = QtGui.QHBoxLayout(self.BookButtonWidget) + self.BookButtonLayout.setSpacing(8) + self.BookButtonLayout.setMargin(0) + self.BookButtonLayout.setObjectName("BookButtonLayout") + spacerItem2 = QtGui.QSpacerItem(54, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.BookButtonLayout.addItem(spacerItem2) + self.BookAddButton = QtGui.QPushButton(self.BookButtonWidget) + icon9 = QtGui.QIcon() + icon9.addPixmap(QtGui.QPixmap(":/songs/book_add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.BookAddButton.setIcon(icon9) + self.BookAddButton.setObjectName("BookAddButton") + self.BookButtonLayout.addWidget(self.BookAddButton) + self.BookEditButton = QtGui.QPushButton(self.BookButtonWidget) + icon10 = QtGui.QIcon() + icon10.addPixmap(QtGui.QPixmap(":/songs/book_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.BookEditButton.setIcon(icon10) + self.BookEditButton.setObjectName("BookEditButton") + self.BookButtonLayout.addWidget(self.BookEditButton) + self.BookDeleteButton = QtGui.QPushButton(self.BookButtonWidget) + icon11 = QtGui.QIcon() + icon11.addPixmap(QtGui.QPixmap(":/songs/book_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.BookDeleteButton.setIcon(icon11) + self.BookDeleteButton.setObjectName("BookDeleteButton") + self.BookButtonLayout.addWidget(self.BookDeleteButton) + self.BookLayout.addWidget(self.BookButtonWidget) + self.BooksLine = QtGui.QFrame(self.BooksPage) + self.BooksLine.setFrameShape(QtGui.QFrame.HLine) + self.BooksLine.setFrameShadow(QtGui.QFrame.Sunken) + self.BooksLine.setObjectName("BooksLine") + self.BookLayout.addWidget(self.BooksLine) + self.TypeStackedWidget.addWidget(self.BooksPage) + self.ContentLayout.addWidget(self.TypeStackedWidget) + self.DialogLayout.addWidget(self.ContentWidget) + self.MaintenanceButtonBox = QtGui.QDialogButtonBox(SongMaintenanceDialog) + self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal) + self.MaintenanceButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) + self.MaintenanceButtonBox.setObjectName("MaintenanceButtonBox") + self.DialogLayout.addWidget(self.MaintenanceButtonBox) + + self.retranslateUi(SongMaintenanceDialog) + self.TypeStackedWidget.setCurrentIndex(2) + QtCore.QObject.connect(self.MaintenanceButtonBox, QtCore.SIGNAL("rejected()"), SongMaintenanceDialog.accept) + QtCore.QObject.connect(self.TypeListWidget, QtCore.SIGNAL("currentRowChanged(int)"), self.TypeStackedWidget.setCurrentIndex) + QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) + + def retranslateUi(self, SongMaintenanceDialog): + SongMaintenanceDialog.setWindowTitle(QtGui.QApplication.translate("SongMaintenanceDialog", "Song Maintenance", None, QtGui.QApplication.UnicodeUTF8)) + __sortingEnabled = self.TypeListWidget.isSortingEnabled() + self.TypeListWidget.setSortingEnabled(False) + self.TypeListWidget.item(0).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Authors", None, QtGui.QApplication.UnicodeUTF8)) + self.TypeListWidget.item(1).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Topics", None, QtGui.QApplication.UnicodeUTF8)) + self.TypeListWidget.item(2).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Books/Hymnals", None, QtGui.QApplication.UnicodeUTF8)) + self.TypeListWidget.setSortingEnabled(__sortingEnabled) + self.AuthorAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) + self.AuthorEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) + self.AuthorDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) + self.TopicAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) + self.TopicEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) + self.TopicDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) + self.BookAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) + self.BookEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) + self.BookDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py new file mode 100644 index 000000000..c39bcd5ec --- /dev/null +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- +""" +OpenLP - Open Source Lyrics Projection +Copyright (c) 2008 Raoul Snyman +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +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., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA +""" + +from PyQt4 import QtGui, QtCore +from openlp.core.lib import translate +from openlp.plugins.songs.forms import SongBookForm +from openlp.plugins.songs.lib.classes import Author, Book, Topic +from songmaintenancedialog import Ui_SongMaintenanceDialog + +class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): + """ + Class documentation goes here. + """ + def __init__(self, songmanager, parent=None): + """ + Constructor + """ + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + self.songmanager = songmanager + self.timer = QtCore.QTimer() + QtCore.QObject.connect(self.timer, + QtCore.SIGNAL(u'timeout()'), self._hideErrors) + QtCore.QObject.connect(self.AuthorDeleteButton, + QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick) + QtCore.QObject.connect(self.TopicDeleteButton, + QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick) + QtCore.QObject.connect(self.BookDeleteButton, + QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick) + + def exec_(self): + self.resetAuthors() + self.resetTopics() + self.resetBooks() + return QtGui.QDialog.exec_(self) + + def _getCurrentItemId(self, ListWidget): + item = ListWidget.currentItem() + print item + if item is not None: + item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + return item_id + else: + return -1 + + def _showError(self, error): + self.AuthorsErrorLabel.setSize(QtCore.QSize(0, 32)) + self.AuthorsErrorLabel.setText(error) + self.TopicsErrorLabel.setMaximumHeight(32) + self.TopicsErrorLabel.setMinimumHeight(32) + self.TopicsErrorLabel.setText(error) + self.BooksErrorLabel.setMaximumHeight(32) + self.BooksErrorLabel.setMinimumHeight(32) + self.BooksErrorLabel.setText(error) + self.timer.start(2000) + + def _hideErrors(self): + self.timer.stop() + self.AuthorsErrorLabel.setMaximumHeight(0) + self.AuthorsErrorLabel.setMinimumHeight(0) + self.AuthorsErrorLabel.clear() + self.TopicsErrorLabel.setMaximumHeight(0) + self.TopicsErrorLabel.setMinimumHeight(0) + self.TopicsErrorLabel.clear() + self.BooksErrorLabel.setMaximumHeight(0) + self.BooksErrorLabel.setMinimumHeight(0) + self.BooksErrorLabel.clear() + + def resetAuthors(self): + self.AuthorsListWidget.clear() + authors = self.songmanager.get_authors() + for author in authors: + if author.display_name is not None and author.display_name != u'': + author_name = QtGui.QListWidgetItem(author.display_name) + else: + author_name = QtGui.QListWidgetItem( + u'%s %s' % (author.first_name, author.last_name)) + author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) + self.AuthorsListWidget.addItem(author_name) + + def resetTopics(self): + self.TopicsListWidget.clear() + topics = self.songmanager.get_topics() + for topic in topics: + topic_name = QtGui.QListWidgetItem(topic.name) + topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id)) + self.TopicsListWidget.addItem(topic_name) + + def resetBooks(self): + self.BooksListWidget.clear() + books = self.songmanager.get_books() + for book in books: + book_name = QtGui.QListWidgetItem(book.name) + book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id)) + self.BooksListWidget.addItem(book_name) + + def onAuthorDeleteButtonClick(self): + """ + Delete the author if the author is not attached to any songs + """ + author_id = self._getCurrentItemId(self.AuthorsListWidget) + if author_id != -1: + author = self.songmanager.get_author(author_id) + if QtGui.QMessageBox.warning(None, + translate(u'SongMaintenanceForm', u'Delete Author'), + translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected author?'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) + ) == QtGui.QMessageBox.Yes: + if len(author.songs) == 0: + self.songmanager.delete_author(author.id) + self.resetAuthors() + else: + QtGui.QMessageBox.critical(None, + translate(u'SongMaintenanceForm', u'Delete Author'), + translate(u'SongMaintenanceForm', u'This author can\'t be deleted, they are currently assigned to at least one song!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + else: + self._showError(translate(u'SongMaintenanceForm', u'No author selected!')) + + def onTopicDeleteButtonClick(self): + """ + Delete the Book is the Book is not attached to any songs + """ + topic_id = self._getCurrentItemId(self.TopicsListWidget) + if topic_id != -1: + topic = self.songmanager.get_topic(topic_id) + if QtGui.QMessageBox.warning(None, + translate(u'SongMaintenanceForm', u'Delete Topic'), + translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected topic?'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) + ) == QtGui.QMessageBox.Yes: + if len(topic.songs) == 0: + self.songmanager.delete_topic(topic.id) + self.resetTopics() + else: + #QtGui.QMessageBox.critical(None, + # translate(u'SongMaintenanceForm', u'Delete Topic'), + # translate(u'SongMaintenanceForm', u'This topic can\'t be deleted, it is currently assigned to at least one song!'), + # QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + self._showError(translate(u'SongMaintenanceForm', u'This topic can\'t be deleted, it is currently assigned to at least one song!')) + else: + self._showError(translate(u'SongMaintenanceForm', u'No topic selected!')) + + def onBookDeleteButtonClick(self): + """ + Delete the Book is the Book is not attached to any songs + """ + book_id = self._getCurrentItemId(self.BooksListWidget) + if book_id != -1: + book = self.songmanager.get_book(book_id) + if QtGui.QMessageBox.warning(None, + translate(u'SongMaintenanceForm', u'Delete Book'), + translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected book?'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) + ) == QtGui.QMessageBox.Yes: + if len(book.songs) == 0: + self.songmanager.delete_book(book.id) + self.resetBooks() + else: + QtGui.QMessageBox.critical(None, + translate(u'SongMaintenanceForm', u'Delete Book'), + translate(u'SongMaintenanceForm', u'This book can\'t be deleted, it is currently assigned to at least one song!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + else: + self._showError(translate(u'SongMaintenanceForm', u'No book selected!')) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index b49bcac95..5b9dbae38 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -20,9 +20,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, translate, ServiceItem, SongXMLParser , contextMenuAction, contextMenuSeparator - -from openlp.plugins.songs.forms import EditSongForm, AuthorsForm, TopicsForm, SongBookForm +from openlp.core.lib import MediaManagerItem, translate, ServiceItem, \ + SongXMLParser, contextMenuAction, contextMenuSeparator +from openlp.plugins.songs.forms import EditSongForm, AuthorsForm, \ + TopicsForm, SongBookForm, SongMaintenanceForm class SongList(QtGui.QListWidget): @@ -62,6 +63,7 @@ class SongMediaItem(MediaManagerItem): self.authors_form = AuthorsForm(self.parent.songmanager) self.topics_form = TopicsForm(self.parent.songmanager) self.song_book_form = SongBookForm(self.parent.songmanager) + self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager) def setupUi(self): # Add a toolbar @@ -95,17 +97,21 @@ class SongMediaItem(MediaManagerItem): ':/system/system_add.png', self.onSongAddClick, 'SongAddItem') self.addToolbarSeparator() ## Author Edit Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Edit Authors'), - translate(u'SongMediaItem', u'Maintain the list of Song Authors'), - ':/songs/song_author_edit.png', self.onEditAuthorClick, 'SongAuthorEditItem') + #self.addToolbarButton(translate(u'SongMediaItem', u'Edit Authors'), + # translate(u'SongMediaItem', u'Maintain the list of Song Authors'), + # ':/songs/song_author_edit.png', self.onEditAuthorClick, 'SongAuthorEditItem') ## Author Edit Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Edit Books'), - translate(u'SongMediaItem', u'Maintain the list of Song Books'), - ':/songs/song_book_edit.png', self.onEditBookClick, 'SongAuthorEditItem') - ## Author Edit Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Edit Topics'), - translate(u'SongMediaItem', u'Maintain the list of Song Topics'), - ':/songs/song_topic_edit.png', self.onEditTopicClick, 'SongAuthorEditItem') + #self.addToolbarButton(translate(u'SongMediaItem', u'Edit Books'), + # translate(u'SongMediaItem', u'Maintain the list of Song Books'), + # ':/songs/song_book_edit.png', self.onEditBookClick, 'SongAuthorEditItem') + # ## Author Edit Button ## + #self.addToolbarButton(translate(u'SongMediaItem', u'Edit Topics'), + # translate(u'SongMediaItem', u'Maintain the list of Song Topics'), + # ':/songs/song_topic_edit.png', self.onEditTopicClick, 'SongAuthorEditItem') + ## Song Maintenance Button ## + self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'), + translate(u'SongMediaItem', u'Maintain the lists of authors, topics and books'), + ':/songs/song_author_edit.png', self.onSongMaintenanceClick, 'SongMaintenanceItem') ## Add the songlist widget ## # Create the tab widget self.SongWidget = QtGui.QWidget(self) @@ -250,6 +256,9 @@ class SongMediaItem(MediaManagerItem): self.song_book_form.load_form() self.song_book_form.exec_() + def onSongMaintenanceClick(self): + self.song_maintenance_form.exec_() + def onSongEditClick(self): item = self.ListView.currentItem() if item is not None: diff --git a/resources/forms/songmaintenance.ui b/resources/forms/songmaintenance.ui index 444e444ec..dd06797fb 100644 --- a/resources/forms/songmaintenance.ui +++ b/resources/forms/songmaintenance.ui @@ -2,6 +2,9 @@ SongMaintenanceDialog + + Qt::ApplicationModal + 0 @@ -13,7 +16,7 @@ Song Maintenance - + 8 @@ -22,7 +25,7 @@ - + 8 @@ -30,37 +33,94 @@ 0 - + + + + 0 + 0 + + + + + 130 + 0 + + - 150 + 130 16777215 false + + false + + + QAbstractItemView::SingleSelection + 32 32 - - QListView::TopToBottom + + false - - 0 + + false - - QListView::IconMode - - + + false + + true - - + + + false + + + false + + + false + + + true + + + false + + + false + + - Authors + New Row + + + + + New Row + + + + + New Row + + + + + Types + + + + + +Authors AlignHCenter|AlignVCenter|AlignCenter @@ -69,13 +129,11 @@ :/songs/author_maintenance.png:/songs/author_maintenance.png - - ItemIsSelectable|ItemIsEnabled - - + - Topics + +Topics AlignHCenter|AlignVCenter|AlignCenter @@ -84,13 +142,11 @@ :/songs/topic_maintenance.png:/songs/topic_maintenance.png - - ItemIsSelectable|ItemIsEnabled - - + - Books/Hymnals + +Books/Hymnals AlignHCenter|AlignVCenter|AlignCenter @@ -99,19 +155,16 @@ :/songs/book_maintenance.png:/songs/book_maintenance.png - - ItemIsSelectable|ItemIsEnabled - - 0 + 2 - + 8 @@ -122,8 +175,8 @@ - - + + 8 @@ -131,7 +184,7 @@ 0 - + Qt::Horizontal @@ -150,7 +203,7 @@ - :/songs/song_author_edit.png:/songs/song_author_edit.png + :/songs/author_add.png:/songs/author_add.png @@ -161,7 +214,7 @@ - :/songs/song_edit.png:/songs/song_edit.png + :/songs/author_edit.png:/songs/author_edit.png @@ -172,27 +225,177 @@ - :/songs/song_delete.png:/songs/song_delete.png + :/songs/author_delete.png:/songs/author_delete.png + + + + Qt::Horizontal + + + - - - - - - 30 - 20 - 256 - 192 - + + + + 8 - + + 0 + + + + + + + + + 8 + + + 0 + + + + + Qt::Horizontal + + + + 54 + 20 + + + + + + + + Add + + + + :/songs/topic_add.png:/songs/topic_add.png + + + + + + + Edit + + + + :/songs/topic_edit.png:/songs/topic_edit.png + + + + + + + Delete + + + + :/songs/topic_delete.png:/songs/topic_delete.png + + + + + + + + + + Qt::Horizontal + + + + + + + + + 8 + + + 0 + + + + + + + + + 8 + + + 0 + + + + + Qt::Horizontal + + + + 54 + 20 + + + + + + + + Add + + + + :/songs/book_add.png:/songs/book_add.png + + + + + + + Edit + + + + :/songs/book_edit.png:/songs/book_edit.png + + + + + + + Delete + + + + :/songs/book_delete.png:/songs/book_delete.png + + + + + + + + + + Qt::Horizontal + + + + @@ -217,7 +420,7 @@ MaintenanceButtonBox - accepted() + rejected() SongMaintenanceDialog accept() @@ -232,17 +435,17 @@ - TypeListWidget - currentRowChanged(int) + TypeTableWidget + cellClicked(int,int) TypeStackedWidget setCurrentIndex(int) - 82 + 72 163 - 321 + 311 163 diff --git a/resources/images/author_add.png b/resources/images/author_add.png new file mode 100644 index 0000000000000000000000000000000000000000..a12a384672d5a059f4b8bbbf090e185ac87c2bd5 GIT binary patch literal 836 zcmV-K1H1f*P)Mc{K~#9!g^^!KQ(+j!pYQB!JMO=3IT>y$h=>?Wy+|kt?Ixl? z!n%>V3G23QL`uqa5fqqGL?juJL8erqSX>+WM`ZEd(PJprv!oi z;Jf+W=Xt;9{a#Q?_dR%mliAMfuT`T}zO44FDLg{uPHlhl9h|qnwF?bX4KyyqX~T2_ zwY%&BZsXimoxvUuLX^;>o@aPwaHR_rA{IBgz_L684Q>*Ny6g(tp8o z1OaFm?2Q0|0N15Jg>zf#_(D+nfdCYK0Nj2JWSGWdQ2}vA+`e#b0wXbqn3b{tJV{2y z{hIPpjWJ^|xEW^5W~2A)wN_j5A9T2a>*jpL#KjVo#$YfoXQ~}gYE0;8dul@xc6V5r_>0Kc90np1u@HQJJTH*MVq&9} z$4}6lf+E6Y{#NBH#aWyRFk7!tuX3=a&%ZuPEtkmQEb?+b?lUMj>9UY&<~ z+`aN&gXUo@GDa&pUiU(!)5beHI~CZ$;b3?lKQ#Ys6rcOLG3S}&kc50DtwT?H2Sx|`P;;+G9DjAUj=bsa zUn{Z~m{Rqs?MMtkA|W6lh}aBND1O}d1*a7_kHqXzD-@M)vD8!oJtXiMucc2!v9|NEx7uB)cytDS%KKql}#4_ O0000Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02{9W02{9XUK)`c00007bV*G`2iOcA z5F{5Vl0IGl00P=cL_t(I%Y~6^Xj69>#()2FlIG;r#&)*NB3+tl({;EyFLMa<_Hk=eHA6LkG!?)OYZX|mK;YQ_kl(dcG&bzfED)H;D80(5(NH$WfBA|;I~1m0$TtC@6d5Thy4a@&CLX~%CP=x(B2CG zI0qkQ;11vd)I9j?tCya)PS`x(BsR~Jm7MPYw;3+lz-5E51I!AvcRgsB% ztMqI|Wp$Z``b$OA(LE{zbnr{idTfre*E=fO>=TA(!B8rmud}=c!loRcuyn>xa~Cc3 zrm_;L^jO2A0<+7VRQ&>4&->)>;}&zTeWtCXKfjDb*DZHlf2t8^d=1Aw zxM@5MwHb#Sme)q0J_7QOUlz>Tvvrj*{!fST{9%`|ZN=lqT1$tX1Va2eQe;Hyi4DeUP05`1|UW-HE|SCOh0mtS5N7vE_Py zZnynJ>R;ob>Pm+S<*93bN&bN zzp*|}{r+>NZr6zikFK;dnd;Zo@BCuXye6l^0zyz#Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02{9W02{9XUK)`c00007bV*G`2iOcA z5F{<{p6BcU00Q+%L_t(I%axI9NK*k6$NzV`d)(`$tLZj%nY#6GrC1tHO=blaMcIRp z!~~@*42ww1EHto;=u06{WxKYPUI8JuXoaGh_Vc^2Ah@pLjKo$a?Jis@WXpJbwv3``IP-F#o}A)BkBm^I+FyU?THB!KyIzlC?20 z;Ce}6GaBF=sZ8SW>B6kD-EcdsNJ!S<=#hMINC66u9|}Wj3jkpDjZ$y=i-(zn$K`;> zX<>D-W2Y|OWyCGtOgNFsV&B&7;POS_kUXUC+hdvGW(6PLzAhdg?quA?0SH}piN+ry z-`h{D*sF6PVj1_#?}3inZuGBqOi8Ub~H3n__C zhsD^JVm4YDCPoG^(9?nD#`mJxBW~M~$vcpdnyCs2JS>w^iuPt2Z4(lRDLsxQn_+Wr z=n6_WSt)UJgbF3Tu-YA1qh6ME>Hec6!|U<_GHrj_Ic;22fmkE}N%FxX$04J7a6Tsp zly3?fB8!e(q+UU|x&{Ha6T{u#G1Sw;7fYne+2EDeIR5^A=>XuK^1yDlBlmO(#vC$) z#Fs*)Eg%RVCBb+&@Q4H9@m9h-O+gm10oHL7gcL33u8ZBw0N~ne4&p;&69K-Q(QZ6w zopf`02L^}g8ycGKj9Z6MZEN0N;Jh;0f**O200000 LNkvXXu0mjf=h2y| literal 0 HcmV?d00001 diff --git a/resources/images/book_add.png b/resources/images/book_add.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d5c841335d19c0f64b9b6aafdc275dd09a2bb7 GIT binary patch literal 670 zcmV;P0%84$P)Xv3uhk}A4@St@FDuqBY z@z6!Pbq@8?B?>%skB*%Tx^+@hT?sgPKY=)=c>=-o~w@3}lakcL_nQWH%g^d^b{^F3LLZ7_cKfv7w z52+_M2aGKZGIHhyqg|uCX?{g}>&xrnsko!Cetz8gu-wAU!7G%~Jv5xZ#X(6^j1AWA z;nx%|tTUILWu$$8_3T@scm$w8fUV4YA&MC(G z#<6;j^kcPsYU^^SqT?9pIB4UPpAPMZe0*2Ys82BQb%N8+1@G2oxHo%|OEZGa^yXSJ zpi4+8@m!aD>=2aCzUR`pGf3bcBNM`239=!)_W+MaiGckh%5m&dD@U;;=&&o4PtTWW z!reZu&5!czSB7wDXw?jx$BG1ll#X3cbp@INS&ntnyE={K2v}KO_zsW=IDk@;hQOnm zuLPbpXibF>0@w4Y4OHfPG=%}xgfIj`U^Hkz0A9U-a$Qn%_U#~4E2BPsbh7=c@FfmD)we&2q`e+T~F>(&Mk4*5c! zLh*ovx=UmtklEeYBHG(#Be%`x)o=Vyu@ti(MLz(31JF;k9rOM+qW}N^07*qoM6N<$ Ef@xJQ3IG5A literal 0 HcmV?d00001 diff --git a/resources/images/book_delete.png b/resources/images/book_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..293cf966689f34c9266bb2f94fba82593622d570 GIT binary patch literal 744 zcmVP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L00FxI00FxJI_%@(00007bV*G`2iXS} z5*{KTG&(T=00L-9L_t(I%Y~3jNK{c6$A9PCbMBoxT9YrrN1{ETB2g?zqZb%P5w$5o z)Eo;>|C_~BwFBRyfNhq_qNeUre##Y}(x#EYg~#Kyw-p~6O>T^M5!Lfo!g zRl6e=jgT&=CRo|TblPV_?Y022x5KZIkT=NVv7UE~q675W)};0^@@Z46kdz8hCCpPEcAi zFDHjA*Wq`h5P-oq1`ycx%oAq`w54zZ0fJ7Z0KgIk-v|r_t({DPQVMAdu4D5zgfL(P z`cE5J%EI$vC}sU!@H4A31qg|k@JJ-5`5!`9vjlG@C&r0SMTvZk@+v&?&*o%0MJyiw a2=EQH($_h6#%oRh0000Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L00FxI00FxJI_%@(00007bV*G`2iXS} z5*-l3&Ny-a00M|fL_t(I%YD;dXw6|9$MN^``~9BZ`Lp57cEq+unzDvTT9Y^;;(gbtI988e+@|IRr(|9+2)t<`CV@8$D+ zo>!lG`U<5K!oBoLrs+Qr3WfONSOiOU^RLMn?W5ZNoIv`#r)x7*v6ukzpY7VR(sT6q zS^hUxJj{Zh+i0xtlJ&y^Lw`I02+>-wa#cxi*hk#G0%ySD zSZHHwxsgyY7DLxGETs{NLHZ0EW8-n=r+lSu{Qz5Q-Z1$4B`pn`X@0l!^UeDE-x2{U zj;`yNQZgQcnRXqGFy}UPa^XflpL#}Vs&mru!$!L|@CzUTP)cEF8a6p`9Erox!Zvz( zhq!&OlcMY}z1=|`rj#O$9;N}H&~*({O6+4j6fW#zxy#Gux;HFz`N*<4Xw7(mF2IoA zrvn;b7&=b7NuGMo!Td+;I}s!r7-3C`hmP!vH~}F9(zGQ3G!2_HNp;w%%5A3cRw|tz zhB;ZG*x)I~+ik}J1Yjlu3@LG?rEw{*l9z8|TzxRY4o{fu+{K*lFC)dNu#^G>rfE(G zq;7Deup6JRgWAh!`7O zXwt{?dAGl6%2m-=T=7IF@mAc0Ki`$Q0#aP(lUSm000015(tFU1&AdJB>n-c_yM5q zSg~Tu3L)_WP$k+$#fCi#x`0Xrq3{T=q)B@p=hz-*#&&&5Z-0byCo{I^dcOH)>?rQ^ z>C-qoJj7s3STh11&k^XIQ!ym;~1NHhZxwWCS6 z@bX*KjHWWBNUR_x*j6n{wXTT~)lU{E1S025xVf`8z4hDS$A^pf>H4I#P3z*>;|9$D z2(di5y}kY7<$ueU-E1~{xM><=t;KRN2VxIn9UAArYgvqHV?+$VnuF=w8rHlgKu#W; zgwL;i=RWvi|MmSJfBy8LQ^#?9I!1>x1wb8FuU@5{ogLx>SuAyn8Ma?~15aFh4J{qu zU?J%jZ>2+nG?v8ycbBBWsd$jAo49|sch8+Wx%rKG1%Lij8()}wg<1a>%zqeohUG@C zFBwjeV#M~F@8i{XK1Abh<6voUbGOI1F%r0ZQG-7Hh{Miaz@q2%vXL}dc9^)hpyl2L zUik^O6^`fu287D#bgFjm1Hy8FJH5jn`*WOdOKeVC{L*-Yz$g{Ikzg`sACJe@ErW<~ z7K$Rf=zr*giDtAFGB^6MxPK^f&N-E`Fd4P@X9n!CSdRMmMvDOH0SA+Npye9e?F>9w ztWO*Wr7v_}{hT$yB6zFcj?7xbN(S1t1yirKlQUd{5mWy6ortylh^ICkb`K&VCF*6c z(yVXK2^(t$OD}u6lRr8FTYebNt^h#X{ctSW>3>cbX@zJ8VetzC*ykYUHX8&ol9hr` zu+|FA@X=sxWEGW7`(%u2Z>@-~6VD$2ppFcH#pOd;npSQ38MhWc>_$C!eQZIv7v!G* zyyvpDWleRtmR>=WHTxg{&AQR-U2@WX;JKEwe({e(X5plQtU)q>5aos_V`aa9^lS&2 zXMb7Q0}6nMv~et1Ek_BW`wV8*0bKx29kOTY{J)q8o6_f)j0?jZ`lChS-a;8CuEqUVpi|^2Jn&qkEt-;07fq4AkHyonoj@&mcyQU`QV% zeV#M*T~alHMh+yRAp^sP)9jIb)JuF#4oVe8Su?7I39Bp^(*7W8DuChm{~q8u^i_)> z79%Gq21;y@XaS~W%{uM(UJ?-Zg4<*ORJ!wM26W%b0Z!A4k<`z`C|fmnntw>ZqFL2G zi$O|9rDi>9DBV{8gF(VTp}+J10hNJ5zcz6VG`McnC+nzd3a+d1Q*TrNwFFd3VD%|Z z41^d21uxd7tC@-(1|5RA&$qiTTUr4ia+Y1!!F#WE@By9!n~)ix8dz1ej|NnM^{Js# z8NYb%EbP|S)-e7--}i?+Fn^!ViEWxMlJ+4`VDTbe#Ix;_9g^LPtvapuy6=mYL>8jE z#T;+HdnU2GySpozu3x{7D_5@k&B1O7fW=}Vfz5orFkTWjjR|lj8j(gNWF4V8?ZM?e zwX23h?*)zlH4}XH$*<`eGR>Ct_|m0I#{!Ryjg4=)1kW>o+kt71et%*2cYnmPIbmWy zBV%m&-;7Er2d|+rT+3jH6=|0exj(=E`u7`Oe)Q;Q{Uo}({~WTz(v;p~X|s%3w(=Vx z;6}C?wKAs|ED-}H8vgrTz{IRW7N4chGLsT#pDwS3e*qj)^b5A~t?vK;03v!+Saefw zW^{L9a%BJjc-kv3FC*8>%*!rLPAo{(%P&d?05;eLSP)anTmS$707*qoM6N<$f;EpK A7XSbN delta 1891 zcmV-p2b}o24e}0= z=q_1z*$&v)U?4H(5|@^gCWX?FkWSK;>5aT((&s+(U-T(&X@C3LJhcx^A9@{Tn$T&d zBn)+NfsimT0b_i@vMn7Q9Z5%*bIW2|$6!g8JCko_&E98pw7+%Mx4!R4!gXDInGiyN zp%8-b5q=^#tsr;y$dO~CV`B#|UcC654{W!99w78y60)s$}FZ9|O=5o*x{vJt(vf1p< z2L}ho9LLEq_WaDXvJ(Qqi0i~cjuQzOWrS-9)UJL6r_}@)=~vD{yLBC|Y07I`Vk2^{ zc$Q0usP`qn2!+GpcTS!>`O|zp4^7iRB2aG5x~XPepnn}EG4$g%QTg9Bcv1W8Q$(i@ zqjvKKIwK2YxI}vqP&%#y#E7CO@cDdbHk)WP8c+j4mI@#?!&Hk%e)AN(XysQB-n$RI zA|u?uw|zJP#!du+Od2KuSq_tOwpuNe!x1T`L)h*Hv@2JT`R;id;#H8CWGDE&UJ)aP zftUXu0)G~bQe#rINk|2%0|Oh$36Dta!5r59{6{27ApO1bup!`pa3SG7flM+eFew;2 zdB7ypN~IzR(155`t1vRDO+$&NR`uhL;LGNaJn;fVI1Go1Ie`FZ#4Y#1r2;}saN`4D z^;Lja_XtEH5m^HL=@NKr8>@f$6V^ZcJ0g>l5`X?(yL;Z35!l5gxKjyiBG0Fm@>`Y# z+qO}3T*=J#(2<~U`QLc-{_kP)$%lV(0jZbI0^#tM`x363OaQ5!2)M)pD&SB7NkIC5 zD&&O%yIo(dU7pbI-a+mDeKb`Sv7^WE%v*0GdgLfvo?~wq(f6W)Z}cVLGPtbOYPG88 z7k{r49xA@A(t1RmT9tSl3%~m<@_+j)Ov6Cx#g~vf{{sYek07v7hEttB^rJh9hGA5w zK*DQ9wkGO+KWs~y%ZskPBd8kh)$iRyb#4v=lZTL;o<@cxsXu&(J)hj1LP1jiIK33` zLZc8BuND1FOcJPv!X2`A?;R5Kt}Vxbc7OXbEdAkqj_6wm4i95$`uHRO|4s@RgzgzJ zkx0lAR34kE-22JpLHxYQ?yA0r$C+1SO%{Zr2>^;X!|E8 zlw=Z3P3vkw53PC~&isSu5xzOQP1rpP3N)g3EfvuG0UAxfZo}JqiGt7ULZejbN`LN= zOTX}S?0xM!;zTBWZl@BM#5xrKy#USu2^E0d%Y5#}Re0A3v`=qIQr_p0;X$O>iqYM> z(IPqZzcXkpE*)cO<=NX2aEXQbW62z6a~M@vhIKsT8fPwLGWTwA@ z$j}f>UB}vgW}tumIRulYAtsqZc7MWl1RP?XFCm)*d~Fi440H6vxMO!ESJ)|mOa_s$ zG337bHH6Y>SX6NB+BJ5-C+rSu^Zv9@CICACpxKLnl!g+mb2ZriajxKR14$r8AJ{D$ zqC;n*#;wAkY;mQD?-#U?)fwTz@8UT3ZiI zA3B8nKl~9K5-qUb^DIM)vWsnoRmgQ?QvzcEZuKLe6EzY*C=`+ka1Sj=1>7fxjeP42 z#$J6z_WJGj-a~C^u{&wU8XzWwIJFZ2gQ&0sauRwzCnC`PR!FJBmCF=8wgo zFZM|;2>M5~OU$|+_c}pA?|*0zW!By60*M0Q02qJ$4Mges*>~TC%|n*2e7vRqMKmgZ zpa_-@Bn=KRm;RAZd^Dmse89{j#! z>%f5n{$a`-=izB4%YTwkiG4plH6?$vW-=L>Ajl`RSdwa?fLgJL{LBpU3k!C+RH_$O zSM`;J1x>HlHPtZGJG%Z(ze(r~qr%Y8kapq1g&hAK$wXl)5C`C6cNCVF@!&Due zp{igrO_H1Cy6a}GehouJZA&?2lh+{b}F(T{+S%YGtDsDw_`+X+n1 d^k4Sx{TK6P+-A`=TH*iz002ovPDHLkV1n>;gTnv- diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index de5da6a9f..98480206a 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -1,5 +1,14 @@ + topic_edit.png + author_add.png + author_delete.png + book_add.png + topic_add.png + book_delete.png + book_edit.png + author_edit.png + topic_delete.png book_maintenance.png author_maintenance.png topic_maintenance.png diff --git a/resources/images/topic_add.png b/resources/images/topic_add.png new file mode 100644 index 0000000000000000000000000000000000000000..3754fc60e88139f15b3141c42ed61d089c644939 GIT binary patch literal 1007 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L05@C!05@C#%g3a-00007bV*G`2iXS} z5)CEazwQ7400VDHL_t(I%T1C?Oq^95#n1iUJKx8=Dbt~J1`0xp2$+~Lg+e2y;-e%k znwYl6G*J|dw#Jpl#6**Jp)8C|6Be47E^J-+NF^~%p|+t+N&?K3#1_*kT3(fh6gn_7 z4BzA4>!Ky?S)Ikn@0`V9EeBiSm=;)pz&1E$`wKA3-C*m%U585I{^x{A;Zb*7E>vY| z6Xj2DOZ}Nzm|mU!r29;F??+v)gU=>saQ^Bq2>85AS-_SmZ}r~Jn%?-6;iLXCYP^ZR zcHQ0X)E%yVb?d2yQ{Jp68_lrHp|jz$lb3%Qx=!tHy@1;T8T|T9zaBhyotL(IzNHF# zPgdmIj9%Bt{0+87YZ#jEg@(e+yPY4x;ed1_TK(#;_^&JKK~T^RK$d6DXK083V}=k~aL#I`x8Y{^Urea`&3)@Y+J?g4 z_-=GA0pXqBg508`Ze1n#Acosoa^wC8HFDyL5o67wQqzQH8FK}VJ#hdr7`Ntn%=7*e zyT9xQt4A01_Wc2Eagwf9*?*|BYM*gB=nE>XG!;}HD;Z0;Y?wnif)xKQqD z34XtE1rML`K*!#Bmq(*fIhszLZf$PvjKwSE_IONoyu7~=z=YQ`Q~+E6u-y$*RKy=X@{w{5z~G!0Nhx`0X>>;-k@z7T zF5WpcHQhZjGJMiBO<0yy0AK-d0BHUQzyrXiwGI+dB$vx;(=dlhA|(UKWb%@fG9;zk d%*zLh^#4=LdgeE|-46f&002ovPDHLkV1ms(&fWk3 literal 0 HcmV?d00001 diff --git a/resources/images/topic_delete.png b/resources/images/topic_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..38a2ad5b5edee7122e5f290a347d97de721feccd GIT binary patch literal 1038 zcmV+p1o8WcP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L05@C!05@C#%g3a-00007bV*G`2iXS} z5)>DVXcm|N00WLmL_t(I%T113Oq*o@hTre|{`PN6PirYcIggF7j1jGYt&kDj76yhz z6EmYRF=HNKb0&+27*B~8W*2135)+LVx_Ciivc+++Yy&p73JGX!M3J#zI29-d0b6?d z`~Tnfc`-4(SMSA}=Y2@`pRN7eP+%WJ0{!_#@LiG>Q~ zMCl<%t?QLo@1#;XGTY67CoO<@XLI-_`|05@7QzV(-M){x2MJc+S$fq`sT@un$T!rC zLEMpLVjr4EuFj=YeHVFJ-OA;gfu5y?lCF45ks!gd^&qOGT$6$ttl8B-@2ghEDOIRq zrlju5U)a+d#dczQ-O4J#df8x5Vd)Q4{rDBckLUKhHlS33XC?n0m)1jV0O$t;ZGGj^ zb+qWWWii=qCrcYC@FXE?!+M*&5Vr(C4GqHkYYoVYPrZtTFi`XP63iY+IdWnvCXNQ5 zEg!I(oN`TH603^tM^wvpVe|kRYi?*>B5(XbVDD__j#$p6k)_Y82jViBf!p_dE+hS^ZEGC;a|RO zJb19fUtG?Miv7H;y|os=lvTBmjFy$#d%9ix{zAO|+9?QTU?cH2z(g{wr=VCVnOm3< z01N=g8CjH;7XN>^(|`dmGsY~Ob5>B`D+>eyKe$}(J+rfO7e+@%E~%;tP17;}GypmP z$#wut0Bll92c^`TOs1r2R);-a&tNDN8sMBeIp^DZ{-2Tj7rAtgxH|zI+yDRo07*qo IM6N<$g3FNLR{#J2 literal 0 HcmV?d00001 diff --git a/resources/images/topic_edit.png b/resources/images/topic_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..03b8167d0ffadaafea18f3f3547306eea7e03153 GIT binary patch literal 1024 zcmV+b1poVqP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L05@C!05@C#%g3a-00007bV*G`2iXS} z5*Y!_65WIV00V$YL_t(I%UzFcOqFE-hOg&&U(PEB4ip3)KBY#A2#jTjkf3#ze7R{E z;#|2Xe?(<#&8=n5K4vs)jONx>i>d45Pua#6F-^)yYO@i}rbU1sd`K!1aDa2p`=0ka zPe07fb#M1}|G2mNxWsCcY8vI|RW+$vQETxr*qLmim zU@ROObq>5&+S~m8uEqSUNd>0SZJhq=XD0fC^quHs^v|GC){=9~cduFHnlU#bqQcct zTIy;i&tlhTx?M+zZ@ zmRg8)W>8h=LV1-Ymiqk|6K~8+U;3uhbP_^HuSP3i!IQffb6K=Ch9O0qHV_DrAslw* zual3xaE2RGeRLeG(Ko%Xyu80HJZ4&p77~Syg0$l%y&jF3D1^r}wP_f_qcv~lmeO`~ zilNK%eEgc1r0A(bUv299?AOU!L||)xh3ioU`y^gWZ}sO3XA-hyks%Ewq>wwTM4XFx z?B3f=iQneY^2N|UW8vJ>)x|STG^Ru$yLjmM1+;C*n5)(NMcJJ9u;;LM##F0PU0EH; zpr+*_d1B**i?sZ0wTXXT0{l9ri>2R2sVizPAe{WSCR1ISl<>b@%s5qLZ!$c}w3 zBO}*%YI8AX6X)s@{Tx>yT^p79TLEJGhG&`Rhk~~!@uX-O!%_2ptH8n1k)Dq3rF3-8 z@z&E0f%UJG7Z?!3+z`vf6%G4Yv!xXQP+3z&@RFD7W7AC8{mlMYr~7^%;<+}-6IBuF z>*F~(k=c@*CqB|jODCjMdh<`5zw0GTfZ)jzN}nI+nLRtvCs*s~>0|8q@NV)mZMIfB zoDVnh%i%B2M%^g)q@`jSCT{x%&dnXVMR2EjI*;i2xj|anzh>|DYs4jQ(MHab(Yj5w zMZj>pwM2yNh`!x7Z->lGKMnP@#F?|C$B%GecP>j(w=o)Au0s=-72pCmZiJkiEXK#L z{(l<-h%YNn)160J^w8i1U0Yi-+|<;h%gfik3#40?l@9m-58R@^^MVIR0DMx)B&C#G uRalr+u(BYttLxhV+qMA~f%*R&0@S~%CVK9AjxSvR0000 Date: Fri, 24 Jul 2009 22:40:34 +0200 Subject: [PATCH 3/7] Lots of yummy updates to the song maintenance form. --- openlp/plugins/songs/forms/authorsdialog.py | 128 +++------- openlp/plugins/songs/forms/authorsform.py | 223 +++++++++-------- openlp/plugins/songs/forms/maintenanceform.py | 133 ----------- openlp/plugins/songs/forms/songbookdialog.py | 115 +++------ openlp/plugins/songs/forms/songbookform.py | 97 +------- .../songs/forms/songmaintenancedialog.py | 28 +-- .../songs/forms/songmaintenanceform.py | 224 ++++++++++------- openlp/plugins/songs/forms/topicsdialog.py | 81 ++----- openlp/plugins/songs/forms/topicsform.py | 102 +------- openlp/plugins/songs/lib/classes.py | 3 +- openlp/plugins/songs/lib/manager.py | 4 +- openlp/plugins/songs/lib/mediaitem.py | 8 +- openlp/plugins/songs/lib/models.py | 4 +- openlp/plugins/songs/lib/tables.py | 2 +- resources/forms/authorsdialog.ui | 225 ++++-------------- resources/forms/songbookdialog.ui | 213 ++++------------- resources/forms/topicsdialog.ui | 164 +++---------- 17 files changed, 495 insertions(+), 1259 deletions(-) delete mode 100644 openlp/plugins/songs/forms/maintenanceform.py diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index 44fe4c478..d56eaa663 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -22,100 +22,44 @@ from openlp.core.lib import translate class Ui_AuthorsDialog(object): def setupUi(self, AuthorsDialog): - AuthorsDialog.setObjectName(u'AuthorsDialog') - AuthorsDialog.resize(410, 505) - self.DialogLayout = QtGui.QVBoxLayout(AuthorsDialog) - self.DialogLayout.setSpacing(8) - self.DialogLayout.setMargin(8) - self.DialogLayout.setObjectName(u'DialogLayout') - self.AuthorListWidget = QtGui.QListWidget() - self.AuthorListWidget.setAlternatingRowColors(True) - self.DialogLayout.addWidget(self.AuthorListWidget) - self.AuthorDetails = QtGui.QGroupBox(AuthorsDialog) - self.AuthorDetails.setMinimumSize(QtCore.QSize(0, 0)) - self.AuthorDetails.setObjectName(u'AuthorDetails') - self.AuthorLayout = QtGui.QVBoxLayout(self.AuthorDetails) - self.AuthorLayout.setSpacing(8) - self.AuthorLayout.setMargin(8) - self.AuthorLayout.setObjectName(u'AuthorLayout') - self.DetailsWidget = QtGui.QWidget(self.AuthorDetails) - self.DetailsWidget.setObjectName(u'DetailsWidget') - self.DetailsLayout = QtGui.QFormLayout(self.DetailsWidget) - self.DetailsLayout.setMargin(0) - self.DetailsLayout.setSpacing(8) - self.DetailsLayout.setObjectName(u'DetailsLayout') - self.DisplayLabel = QtGui.QLabel(self.DetailsWidget) - self.DisplayLabel.setObjectName(u'DisplayLabel') - self.DetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.DisplayLabel) - self.DisplayEdit = QtGui.QLineEdit(self.DetailsWidget) - self.DisplayEdit.setObjectName(u'DisplayEdit') - self.DetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.DisplayEdit) - self.FirstNameLabel = QtGui.QLabel(self.DetailsWidget) - self.FirstNameLabel.setObjectName(u'FirstNameLabel') - self.DetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FirstNameLabel) - self.FirstNameEdit = QtGui.QLineEdit(self.DetailsWidget) - self.FirstNameEdit.setObjectName(u'FirstNameEdit') - self.DetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FirstNameEdit) - self.LastNameLabel = QtGui.QLabel(self.DetailsWidget) - self.LastNameLabel.setObjectName(u'LastNameLabel') - self.DetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.LastNameLabel) - self.LastNameEdit = QtGui.QLineEdit(self.DetailsWidget) - self.LastNameEdit.setObjectName(u'LastNameEdit') - self.DetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.LastNameEdit) - self.AuthorLayout.addWidget(self.DetailsWidget) - self.MessageLabel = QtGui.QLabel(self.AuthorDetails) - self.MessageLabel.setObjectName(u'MessageLabel') - self.AuthorLayout.addWidget(self.MessageLabel) - self.ButtonWidget = QtGui.QWidget(self.AuthorDetails) - self.ButtonWidget.setMinimumSize(QtCore.QSize(0, 0)) - self.ButtonWidget.setObjectName(u'ButtonWidget') - self.ButtonLayout = QtGui.QHBoxLayout(self.ButtonWidget) - self.ButtonLayout.setSpacing(8) - self.ButtonLayout.setMargin(0) - self.ButtonLayout.setObjectName(u'ButtonLayout') - spacerItem = QtGui.QSpacerItem(198, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.ButtonLayout.addItem(spacerItem) - self.ClearButton = QtGui.QPushButton(self.ButtonWidget) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/services/service_new.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.ClearButton.setIcon(icon) - self.ClearButton.setObjectName(u'ClearButton') - self.ButtonLayout.addWidget(self.ClearButton) - self.AddUpdateButton = QtGui.QPushButton(self.ButtonWidget) - icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(u':/services/service_save.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.AddUpdateButton.setIcon(icon1) - self.AddUpdateButton.setObjectName(u'AddUpdateButton') - self.ButtonLayout.addWidget(self.AddUpdateButton) - self.DeleteButton = QtGui.QPushButton(self.ButtonWidget) - icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(u':/services/service_delete.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.DeleteButton.setIcon(icon2) - self.DeleteButton.setObjectName(u'DeleteButton') - self.ButtonLayout.addWidget(self.DeleteButton) - self.AuthorLayout.addWidget(self.ButtonWidget) - self.DialogLayout.addWidget(self.AuthorDetails) - self.buttonBox = QtGui.QDialogButtonBox(AuthorsDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(u'buttonBox') - self.DialogLayout.addWidget(self.buttonBox) + AuthorsDialog.setObjectName("AuthorsDialog") + AuthorsDialog.resize(393, 147) + self.AuthorsLayout = QtGui.QFormLayout(AuthorsDialog) + self.AuthorsLayout.setMargin(8) + self.AuthorsLayout.setSpacing(8) + self.AuthorsLayout.setObjectName("AuthorsLayout") + self.FirstNameLabel = QtGui.QLabel(AuthorsDialog) + self.FirstNameLabel.setObjectName("FirstNameLabel") + self.AuthorsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FirstNameLabel) + self.FirstNameEdit = QtGui.QLineEdit(AuthorsDialog) + self.FirstNameEdit.setObjectName("FirstNameEdit") + self.AuthorsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FirstNameEdit) + self.LastNameLabel = QtGui.QLabel(AuthorsDialog) + self.LastNameLabel.setObjectName("LastNameLabel") + self.AuthorsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.LastNameLabel) + self.LastNameEdit = QtGui.QLineEdit(AuthorsDialog) + self.LastNameEdit.setObjectName("LastNameEdit") + self.AuthorsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.LastNameEdit) + self.DisplayLabel = QtGui.QLabel(AuthorsDialog) + self.DisplayLabel.setObjectName("DisplayLabel") + self.AuthorsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.DisplayLabel) + self.DisplayEdit = QtGui.QLineEdit(AuthorsDialog) + self.DisplayEdit.setObjectName("DisplayEdit") + self.AuthorsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.DisplayEdit) + self.AuthorButtonBox = QtGui.QDialogButtonBox(AuthorsDialog) + self.AuthorButtonBox.setOrientation(QtCore.Qt.Horizontal) + self.AuthorButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) + self.AuthorButtonBox.setObjectName("AuthorButtonBox") + self.AuthorsLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.AuthorButtonBox) self.retranslateUi(AuthorsDialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), AuthorsDialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), AuthorsDialog.reject) + QtCore.QObject.connect(self.AuthorButtonBox, QtCore.SIGNAL("accepted()"), AuthorsDialog.accept) + QtCore.QObject.connect(self.AuthorButtonBox, QtCore.SIGNAL("rejected()"), AuthorsDialog.reject) QtCore.QMetaObject.connectSlotsByName(AuthorsDialog) def retranslateUi(self, AuthorsDialog): - AuthorsDialog.setWindowTitle(translate(u'AuthorsDialog', u'Author Maintenance')) - self.AuthorDetails.setTitle(translate(u'AuthorsDialog', u'Author Details')) - self.DisplayLabel.setText(translate(u'AuthorsDialog', u'Display Name:')) - self.FirstNameLabel.setText(translate(u'AuthorsDialog', u'First Name:')) - self.LastNameLabel.setText(translate(u'AuthorsDialog', u'Last Name:')) - self.ClearButton.setToolTip(translate(u'AuthorsDialog', u'Clear Selection')) - self.ClearButton.setText(translate(u'AuthorsDialog', u'Clear')) - self.AddUpdateButton.setToolTip(translate(u'AuthorsDialog', u'Add Update Author')) - self.AddUpdateButton.setText(translate(u'AuthorsDialog', u'Save')) - self.DeleteButton.setToolTip(translate(u'AuthorsDialog', u'Delete Author')) - self.DeleteButton.setText(translate(u'AuthorsDialog', u'Delete')) - self.buttonBox.setToolTip(translate(u'AuthorsDialog', u'Exit Screen')) + AuthorsDialog.setWindowTitle(QtGui.QApplication.translate("AuthorsDialog", "Author Maintenance", None, QtGui.QApplication.UnicodeUTF8)) + self.DisplayLabel.setText(QtGui.QApplication.translate("AuthorsDialog", "Display Name:", None, QtGui.QApplication.UnicodeUTF8)) + self.FirstNameLabel.setText(QtGui.QApplication.translate("AuthorsDialog", "First Name:", None, QtGui.QApplication.UnicodeUTF8)) + self.AuthorButtonBox.setToolTip(QtGui.QApplication.translate("AuthorsDialog", "Exit Screen", None, QtGui.QApplication.UnicodeUTF8)) + self.LastNameLabel.setText(QtGui.QApplication.translate("AuthorsDialog", "Last Name:", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 256ac2002..94acb27ec 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -18,121 +18,142 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtGui, QtCore from openlp.core.lib import translate -from openlp.plugins.songs.forms.authorsdialog import Ui_AuthorsDialog -from openlp.plugins.songs.lib.classes import Author +from authorsdialog import Ui_AuthorsDialog class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): """ Class to control the Maintenance of Authors Dialog """ - def __init__(self, songmanager, parent = None): + def __init__(self, parent=None): """ Set up the screen and common data """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self.songmanager = songmanager - self.currentRow = 0 - self.author = None + self.autoDisplayName = False + QtCore.QObject.connect(self.FirstNameEdit, + QtCore.SIGNAL(u'textEdited(QString)'), self.onFirstNameEditTextEdited) + QtCore.QObject.connect(self.LastNameEdit, + QtCore.SIGNAL(u'textEdited(QString)'), self.onLastNameEditTextEdited) - QtCore.QObject.connect(self.DeleteButton, - QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick) - QtCore.QObject.connect(self.ClearButton, - QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick) - QtCore.QObject.connect(self.AddUpdateButton, - QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick) - QtCore.QObject.connect(self.DisplayEdit, - QtCore.SIGNAL(u'lostFocus()'), self.onDisplayEditLostFocus) - QtCore.QObject.connect(self.AuthorListWidget, - QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onAuthorListWidgetItemClicked) + def exec_(self, clear=True): + if clear: + self.FirstNameEdit.clear() + self.LastNameEdit.clear() + self.DisplayEdit.clear() + self.FirstNameEdit.setFocus() + return QtGui.QDialog.exec_(self) - def load_form(self): - """ - Refresh the screen and rest fields - """ - self.AuthorListWidget.clear() - # tidy up screen - self.onClearButtonClick() - authors = self.songmanager.get_authors() - for author in authors: - author_name = QtGui.QListWidgetItem(author.display_name) - author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) - self.AuthorListWidget.addItem(author_name) - if self.currentRow >= self.AuthorListWidget.count() : - self.AuthorListWidget.setCurrentRow(self.AuthorListWidget.count() - 1) - else: - self.AuthorListWidget.setCurrentRow(self.currentRow) - self._validate_form() + def onFirstNameEditTextEdited(self, text): + if not self.autoDisplayName: + return + display_name = text + if self.LastNameEdit.text() != u'': + display_name = display_name + u' ' + self.LastNameEdit.text() + self.DisplayEdit.setText(display_name) - def onDeleteButtonClick(self): - """ - Delete the author is the Author is not attached to any songs - """ - self.songmanager.delete_author(self.author.id) - self.load_form() + def onLastNameEditTextEdited(self, text): + if not self.autoDisplayName: + return + display_name = text + if self.FirstNameEdit.text() != u'': + display_name = self.FirstNameEdit.text() + u' ' + display_name + self.DisplayEdit.setText(display_name) - def onDisplayEditLostFocus(self): - self._validate_form() + def autoDisplayName(self): + return self.autoDisplayName - def onAddUpdateButtonClick(self): - """ - Sent New or update details to the database - """ - if self.author == None: - self.author = Author() - self.author.display_name = unicode(self.DisplayEdit.displayText()) - self.author.first_name = unicode(self.FirstNameEdit.displayText()) - self.author.last_name = unicode(self.LastNameEdit.displayText()) - self.songmanager.save_author(self.author) - self.onClearButtonClick() - self.load_form() + def setAutoDisplayName(self, on): + self.autoDisplayName = on - def onClearButtonClick(self): - """ - Tidy up screen if clear button pressed - """ - self.DisplayEdit.setText(u'') - self.FirstNameEdit.setText(u'') - self.LastNameEdit.setText(u'') - self.MessageLabel.setText(u'') - self.DeleteButton.setEnabled(False) - self.author = None - self._validate_form() - self.DisplayEdit.setFocus() - def onAuthorListWidgetItemClicked(self, index): - """ - An Author has been selected display it - If the author is attached to a Song prevent delete - """ - self.currentRow = self.AuthorListWidget.currentRow() - item = self.AuthorListWidget.currentItem() - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - self.author = self.songmanager.get_author(item_id) - self.DisplayEdit.setText(self.author.display_name) - if self.author.first_name is None: - self.FirstNameEdit.setText(u'') - else: - self.FirstNameEdit.setText(self.author.first_name) - if self.author.last_name is None: - self.LastNameEdit.setText(u'') - else: - self.LastNameEdit.setText(self.author.last_name) - if len(self.author.songs) > 0: - self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled')) - self.DeleteButton.setEnabled(False) - else: - self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used')) - self.DeleteButton.setEnabled(True) - self._validate_form() - self.DisplayEdit.setFocus() - - def _validate_form(self): - """ - Validate the form and set if Add button if valid. - """ - # We need at lease a display name - if len(self.DisplayEdit.displayText()) == 0: - self.AddUpdateButton.setEnabled(False) - else: - self.AddUpdateButton.setEnabled(True) +# def load_form(self): +# """ +# Refresh the screen and rest fields +# """ +# self.AuthorListWidget.clear() +# # tidy up screen +# self.onClearButtonClick() +# authors = self.songmanager.get_authors() +# for author in authors: +# author_name = QtGui.QListWidgetItem(author.display_name) +# author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) +# self.AuthorListWidget.addItem(author_name) +# if self.currentRow >= self.AuthorListWidget.count() : +# self.AuthorListWidget.setCurrentRow(self.AuthorListWidget.count() - 1) +# else: +# self.AuthorListWidget.setCurrentRow(self.currentRow) +# self._validate_form() +# +# def onDeleteButtonClick(self): +# """ +# Delete the author is the Author is not attached to any songs +# """ +# self.songmanager.delete_author(self.author.id) +# self.load_form() +# +# def onDisplayEditLostFocus(self): +# self._validate_form() +# +# def onAddUpdateButtonClick(self): +# """ +# Sent New or update details to the database +# """ +# if self.author == None: +# self.author = Author() +# self.author.display_name = unicode(self.DisplayEdit.displayText()) +# self.author.first_name = unicode(self.FirstNameEdit.displayText()) +# self.author.last_name = unicode(self.LastNameEdit.displayText()) +# self.songmanager.save_author(self.author) +# self.onClearButtonClick() +# self.load_form() +# +# def onClearButtonClick(self): +# """ +# Tidy up screen if clear button pressed +# """ +# self.DisplayEdit.setText(u'') +# self.FirstNameEdit.setText(u'') +# self.LastNameEdit.setText(u'') +# self.MessageLabel.setText(u'') +# self.DeleteButton.setEnabled(False) +# self.author = None +# self._validate_form() +# self.DisplayEdit.setFocus() +# +# def onAuthorListWidgetItemClicked(self, index): +# """ +# An Author has been selected display it +# If the author is attached to a Song prevent delete +# """ +# self.currentRow = self.AuthorListWidget.currentRow() +# item = self.AuthorListWidget.currentItem() +# item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] +# self.author = self.songmanager.get_author(item_id) +# self.DisplayEdit.setText(self.author.display_name) +# if self.author.first_name is None: +# self.FirstNameEdit.setText(u'') +# else: +# self.FirstNameEdit.setText(self.author.first_name) +# if self.author.last_name is None: +# self.LastNameEdit.setText(u'') +# else: +# self.LastNameEdit.setText(self.author.last_name) +# if len(self.author.songs) > 0: +# self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled')) +# self.DeleteButton.setEnabled(False) +# else: +# self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used')) +# self.DeleteButton.setEnabled(True) +# self._validate_form() +# self.DisplayEdit.setFocus() +# +# def _validate_form(self): +# """ +# Validate the form and set if Add button if valid. +# """ +# # We need at lease a display name +# if len(self.DisplayEdit.displayText()) == 0: +# self.AddUpdateButton.setEnabled(False) +# else: +# self.AddUpdateButton.setEnabled(True) diff --git a/openlp/plugins/songs/forms/maintenanceform.py b/openlp/plugins/songs/forms/maintenanceform.py deleted file mode 100644 index efd826d63..000000000 --- a/openlp/plugins/songs/forms/maintenanceform.py +++ /dev/null @@ -1,133 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file '/home/raoul/Projects/openlp/songmaintenance/resources/forms/songmaintenance.ui' -# -# Created: Wed Jul 22 10:03:53 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_SongMaintenanceDialog(object): - def setupUi(self, SongMaintenanceDialog): - SongMaintenanceDialog.setObjectName("SongMaintenanceDialog") - SongMaintenanceDialog.resize(486, 361) - self.verticalLayout = QtGui.QVBoxLayout(SongMaintenanceDialog) - self.verticalLayout.setSpacing(8) - self.verticalLayout.setMargin(8) - self.verticalLayout.setObjectName("verticalLayout") - self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog) - self.ContentWidget.setObjectName("ContentWidget") - self.horizontalLayout = QtGui.QHBoxLayout(self.ContentWidget) - self.horizontalLayout.setSpacing(8) - self.horizontalLayout.setMargin(0) - self.horizontalLayout.setObjectName("horizontalLayout") - self.TypeListWidget = QtGui.QListWidget(self.ContentWidget) - self.TypeListWidget.setMaximumSize(QtCore.QSize(150, 16777215)) - self.TypeListWidget.setProperty("showDropIndicator", QtCore.QVariant(False)) - self.TypeListWidget.setIconSize(QtCore.QSize(32, 32)) - self.TypeListWidget.setFlow(QtGui.QListView.TopToBottom) - self.TypeListWidget.setSpacing(0) - self.TypeListWidget.setViewMode(QtGui.QListView.IconMode) - self.TypeListWidget.setUniformItemSizes(True) - self.TypeListWidget.setObjectName("TypeListWidget") - #self.TypeListWidget.setColumnWidth(0, self.TypeListWidget.viewport().size().width()) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(":/songs/author_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - item = QtGui.QListWidgetItem(self.TypeListWidget) - item.setIcon(icon) - icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(":/songs/topic_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - item = QtGui.QListWidgetItem(self.TypeListWidget) - item.setIcon(icon1) - icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(":/songs/book_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - item = QtGui.QListWidgetItem(self.TypeListWidget) - item.setIcon(icon2) - self.horizontalLayout.addWidget(self.TypeListWidget) - self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget) - self.TypeStackedWidget.setObjectName("TypeStackedWidget") - self.AuthorsPage = QtGui.QWidget() - self.AuthorsPage.setObjectName("AuthorsPage") - self.verticalLayout_2 = QtGui.QVBoxLayout(self.AuthorsPage) - self.verticalLayout_2.setSpacing(8) - self.verticalLayout_2.setMargin(0) - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage) - self.AuthorsListWidget.setObjectName("AuthorsListWidget") - self.verticalLayout_2.addWidget(self.AuthorsListWidget) - self.AuthorWidget = QtGui.QWidget(self.AuthorsPage) - self.AuthorWidget.setObjectName("AuthorWidget") - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.AuthorWidget) - self.horizontalLayout_2.setSpacing(8) - self.horizontalLayout_2.setMargin(0) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem) - self.AuthorAddButton = QtGui.QPushButton(self.AuthorWidget) - icon3 = QtGui.QIcon() - icon3.addPixmap(QtGui.QPixmap(":/songs/song_author_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.AuthorAddButton.setIcon(icon3) - self.AuthorAddButton.setObjectName("AuthorAddButton") - self.horizontalLayout_2.addWidget(self.AuthorAddButton) - self.AuthorEditButton = QtGui.QPushButton(self.AuthorWidget) - icon4 = QtGui.QIcon() - icon4.addPixmap(QtGui.QPixmap(":/songs/song_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.AuthorEditButton.setIcon(icon4) - self.AuthorEditButton.setObjectName("AuthorEditButton") - self.horizontalLayout_2.addWidget(self.AuthorEditButton) - self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorWidget) - icon5 = QtGui.QIcon() - icon5.addPixmap(QtGui.QPixmap(":/songs/song_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.AuthorDeleteButton.setIcon(icon5) - self.AuthorDeleteButton.setObjectName("AuthorDeleteButton") - self.horizontalLayout_2.addWidget(self.AuthorDeleteButton) - self.verticalLayout_2.addWidget(self.AuthorWidget) - self.TypeStackedWidget.addWidget(self.AuthorsPage) - self.TopicsPage = QtGui.QWidget() - self.TopicsPage.setObjectName("TopicsPage") - self.TypeStackedWidget.addWidget(self.TopicsPage) - self.BooksPage = QtGui.QWidget() - self.BooksPage.setObjectName("BooksPage") - self.listWidget = QtGui.QListWidget(self.BooksPage) - self.listWidget.setGeometry(QtCore.QRect(30, 20, 256, 192)) - self.listWidget.setObjectName("listWidget") - self.TypeStackedWidget.addWidget(self.BooksPage) - self.horizontalLayout.addWidget(self.TypeStackedWidget) - self.verticalLayout.addWidget(self.ContentWidget) - self.MaintenanceButtonBox = QtGui.QDialogButtonBox(SongMaintenanceDialog) - self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal) - self.MaintenanceButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) - self.MaintenanceButtonBox.setObjectName("MaintenanceButtonBox") - self.verticalLayout.addWidget(self.MaintenanceButtonBox) - - self.retranslateUi(SongMaintenanceDialog) - self.TypeStackedWidget.setCurrentIndex(0) - QtCore.QObject.connect(self.MaintenanceButtonBox, QtCore.SIGNAL("rejected()"), SongMaintenanceDialog.accept) - QtCore.QObject.connect(self.TypeListWidget, QtCore.SIGNAL("currentRowChanged(int)"), self.TypeStackedWidget.setCurrentIndex) - QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) - - def retranslateUi(self, SongMaintenanceDialog): - SongMaintenanceDialog.setWindowTitle(QtGui.QApplication.translate("SongMaintenanceDialog", "Song Maintenance", None, QtGui.QApplication.UnicodeUTF8)) - __sortingEnabled = self.TypeListWidget.isSortingEnabled() - self.TypeListWidget.setSortingEnabled(False) - self.TypeListWidget.item(0).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Authors", None, QtGui.QApplication.UnicodeUTF8)) - self.TypeListWidget.item(1).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Topics", None, QtGui.QApplication.UnicodeUTF8)) - self.TypeListWidget.item(2).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Books/Hymnals", None, QtGui.QApplication.UnicodeUTF8)) - self.TypeListWidget.setSortingEnabled(__sortingEnabled) - self.AuthorAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) - self.AuthorEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) - self.AuthorDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) - -from openlp.core.resources import * - -if __name__ == "__main__": - import sys - app = QtGui.QApplication(sys.argv) - SongMaintenanceDialog = QtGui.QDialog() - ui = Ui_SongMaintenanceDialog() - ui.setupUi(SongMaintenanceDialog) - SongMaintenanceDialog.show() - sys.exit(app.exec_()) - diff --git a/openlp/plugins/songs/forms/songbookdialog.py b/openlp/plugins/songs/forms/songbookdialog.py index 90e9989cc..fdeccb06d 100644 --- a/openlp/plugins/songs/forms/songbookdialog.py +++ b/openlp/plugins/songs/forms/songbookdialog.py @@ -22,98 +22,37 @@ from openlp.core.lib import translate class Ui_SongBookDialog(object): def setupUi(self, SongBookDialog): - SongBookDialog.setObjectName(u'SongBookDialog') - SongBookDialog.resize(387, 531) - self.DialogLayout = QtGui.QVBoxLayout(SongBookDialog) - self.DialogLayout.setSpacing(8) - self.DialogLayout.setMargin(8) - self.DialogLayout.setObjectName(u'DialogLayout') - self.BookSongListWidget = QtGui.QListWidget() - self.BookSongListWidget.setAlternatingRowColors(True) - self.DialogLayout.addWidget(self.BookSongListWidget) - self.DialogLayout.addWidget(self.BookSongListWidget) - self.SongBookGroup = QtGui.QGroupBox(SongBookDialog) - self.SongBookGroup.setMinimumSize(QtCore.QSize(0, 200)) - self.SongBookGroup.setObjectName(u'SongBookGroup') - self.SongBookLayout = QtGui.QVBoxLayout(self.SongBookGroup) - self.SongBookLayout.setSpacing(8) + SongBookDialog.setObjectName("SongBookDialog") + SongBookDialog.resize(367, 120) + self.SongBookLayout = QtGui.QFormLayout(SongBookDialog) self.SongBookLayout.setMargin(8) - self.SongBookLayout.setObjectName(u'SongBookLayout') - self.DetailsWidget = QtGui.QWidget(self.SongBookGroup) - self.DetailsWidget.setMinimumSize(QtCore.QSize(0, 0)) - self.DetailsWidget.setObjectName(u'DetailsWidget') - self.DetailsLayout = QtGui.QFormLayout(self.DetailsWidget) - self.DetailsLayout.setMargin(0) - self.DetailsLayout.setSpacing(8) - self.DetailsLayout.setObjectName(u'DetailsLayout') - self.NameLabel = QtGui.QLabel(self.DetailsWidget) - self.NameLabel.setObjectName(u'NameLabel') - self.DetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.NameLabel) - self.NameEdit = QtGui.QLineEdit(self.DetailsWidget) - self.NameEdit.setObjectName(u'NameEdit') - self.DetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.NameEdit) - self.PublisherLabel = QtGui.QLabel(self.DetailsWidget) - self.PublisherLabel.setObjectName(u'PublisherLabel') - self.DetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.PublisherLabel) - self.PublisherEdit = QtGui.QLineEdit(self.DetailsWidget) - self.PublisherEdit.setObjectName(u'PublisherEdit') - self.DetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.PublisherEdit) - self.SongBookLayout.addWidget(self.DetailsWidget) - self.MessageLabel = QtGui.QLabel(self.SongBookGroup) - self.MessageLabel.setObjectName(u'MessageLabel') - self.SongBookLayout.addWidget(self.MessageLabel) - self.ButtonWidget = QtGui.QWidget(self.SongBookGroup) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ButtonWidget.sizePolicy().hasHeightForWidth()) - self.ButtonWidget.setSizePolicy(sizePolicy) - self.ButtonWidget.setMinimumSize(QtCore.QSize(0, 0)) - self.ButtonWidget.setObjectName(u'ButtonWidget') - self.ButtonLayout = QtGui.QHBoxLayout(self.ButtonWidget) - self.ButtonLayout.setSpacing(8) - self.ButtonLayout.setMargin(0) - self.ButtonLayout.setObjectName(u'ButtonLayout') - spacerItem = QtGui.QSpacerItem(61, 24, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.ButtonLayout.addItem(spacerItem) - self.ClearButton = QtGui.QPushButton(self.ButtonWidget) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/services/service_new.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.ClearButton.setIcon(icon) - self.ClearButton.setObjectName(u'ClearButton') - self.ButtonLayout.addWidget(self.ClearButton) - self.AddUpdateButton = QtGui.QPushButton(self.ButtonWidget) - icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(u':/services/service_save.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.AddUpdateButton.setIcon(icon1) - self.AddUpdateButton.setObjectName(u'AddUpdateButton') - self.ButtonLayout.addWidget(self.AddUpdateButton) - self.DeleteButton = QtGui.QPushButton(self.ButtonWidget) - icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(u':/services/service_delete.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.DeleteButton.setIcon(icon2) - self.DeleteButton.setObjectName(u'DeleteButton') - self.ButtonLayout.addWidget(self.DeleteButton) - self.SongBookLayout.addWidget(self.ButtonWidget) - self.DialogLayout.addWidget(self.SongBookGroup) + self.SongBookLayout.setSpacing(8) + self.SongBookLayout.setObjectName("SongBookLayout") + self.NameLabel = QtGui.QLabel(SongBookDialog) + self.NameLabel.setObjectName("NameLabel") + self.SongBookLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.NameLabel) + self.NameEdit = QtGui.QLineEdit(SongBookDialog) + self.NameEdit.setObjectName("NameEdit") + self.SongBookLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.NameEdit) + self.PublisherLabel = QtGui.QLabel(SongBookDialog) + self.PublisherLabel.setObjectName("PublisherLabel") + self.SongBookLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.PublisherLabel) + self.PublisherEdit = QtGui.QLineEdit(SongBookDialog) + self.PublisherEdit.setObjectName("PublisherEdit") + self.SongBookLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.PublisherEdit) self.ButtonBox = QtGui.QDialogButtonBox(SongBookDialog) self.ButtonBox.setOrientation(QtCore.Qt.Horizontal) - self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) - self.ButtonBox.setObjectName(u'ButtonBox') - self.DialogLayout.addWidget(self.ButtonBox) + self.ButtonBox.setStandardButtons( + QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) + self.ButtonBox.setObjectName("ButtonBox") + self.SongBookLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.ButtonBox) + self.retranslateUi(SongBookDialog) - QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), SongBookDialog.accept) - QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), SongBookDialog.reject) + QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), SongBookDialog.accept) + QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("rejected()"), SongBookDialog.reject) QtCore.QMetaObject.connectSlotsByName(SongBookDialog) def retranslateUi(self, SongBookDialog): - SongBookDialog.setWindowTitle(translate(u'SongBookDialog', u'Book Song Maintenance')) - self.SongBookGroup.setTitle(translate(u'SongBookDialog', u'Song Book')) - self.NameLabel.setText(translate(u'SongBookDialog', u'Name:')) - self.PublisherLabel.setText(translate(u'SongBookDialog', u'Publisher:')) - self.ClearButton.setToolTip(translate(u'SongBookDialog', u'Clear Selection')) - self.ClearButton.setText(translate(u'SongBookDialog', u'Clear')) - self.AddUpdateButton.setToolTip(translate(u'SongBookDialog', u'Add Update Author')) - self.AddUpdateButton.setText(translate(u'SongBookDialog', u'Save')) - self.DeleteButton.setToolTip(translate(u'SongBookDialog', u'Delete Author')) - self.DeleteButton.setText(translate(u'SongBookDialog', u'Delete')) + SongBookDialog.setWindowTitle(QtGui.QApplication.translate("SongBookDialog", "Edit Book", None, QtGui.QApplication.UnicodeUTF8)) + self.NameLabel.setText(QtGui.QApplication.translate("SongBookDialog", "Name:", None, QtGui.QApplication.UnicodeUTF8)) + self.PublisherLabel.setText(QtGui.QApplication.translate("SongBookDialog", "Publisher:", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/plugins/songs/forms/songbookform.py b/openlp/plugins/songs/forms/songbookform.py index cc203cdb4..879bfca3e 100644 --- a/openlp/plugins/songs/forms/songbookform.py +++ b/openlp/plugins/songs/forms/songbookform.py @@ -20,107 +20,22 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtGui, QtCore from openlp.core.lib import translate from songbookdialog import Ui_SongBookDialog -from openlp.plugins.songs.lib.classes import Book class SongBookForm(QtGui.QDialog, Ui_SongBookDialog): """ Class documentation goes here. """ - def __init__(self, songmanager, parent = None): + def __init__(self, parent=None): """ Constructor """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self.songmanager = songmanager - self.currentRow = 0 - self.songbook = None - QtCore.QObject.connect(self.DeleteButton, - QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick) - QtCore.QObject.connect(self.ClearButton, - QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick) - QtCore.QObject.connect(self.AddUpdateButton, - QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick) - QtCore.QObject.connect(self.NameEdit, - QtCore.SIGNAL(u'lostFocus()'), self.onBookNameEditLostFocus) - QtCore.QObject.connect(self.BookSongListWidget, - QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onBooksListViewItemClicked) - - def load_form(self): - """ - Refresh the screen and rest fields - """ - self.BookSongListWidget.clear() - self.onClearButtonClick() # tidy up screen - books = self.songmanager.get_books() - for book in books: - book_name = QtGui.QListWidgetItem(book.name) - book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id)) - self.BookSongListWidget.addItem(book_name) - if self.currentRow >= self.BookSongListWidget.count() : - self.BookSongListWidget.setCurrentRow(self.BookSongListWidget.count() - 1) - else: - self.BookSongListWidget.setCurrentRow(self.currentRow) - - def onDeleteButtonClick(self): - """ - Delete the Book is the Book is not attached to any songs - """ - self.songmanager.delete_book(self.Book.id) - self.load_form() - - def onBookNameEditLostFocus(self): - self._validate_form() - - def onAddUpdateButtonClick(self): - """ - Sent New or update details to the database - """ - if self.Book == None: - self.Book = Book() - self.Book.name = unicode(self.NameEdit.displayText()) - self.Book.publisher = unicode(self.PublisherEdit.displayText()) - self.songmanager.save_book(self.Book) - self.onClearButtonClick() - self.load_form() - - def onClearButtonClick(self): - """ - Tidy up screen if clear button pressed - """ - self.NameEdit.setText(u'') - self.PublisherEdit.setText(u'') - self.MessageLabel.setText(u'') - self.DeleteButton.setEnabled(False) - self.AddUpdateButton.setEnabled(True) - self.Book = None - self._validate_form() + def exec_(self, clear=True): + if clear: + self.NameEdit.clear() + self.PublisherEdit.clear() self.NameEdit.setFocus() + return QtGui.QDialog.exec_(self) - def onBooksListViewItemClicked(self, index): - """ - An Book has been selected display it - If the Book is attached to a Song prevent delete - """ - self.currentRow = self.BookSongListWidget.currentRow() - item = self.BookSongListWidget.currentItem() - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - self.Book = self.songmanager.get_book(item_id) - self.NameEdit.setText(self.Book.name) - self.PublisherEdit.setText(self.Book.publisher) - if len(self.Book.songs) > 0: - self.MessageLabel.setText(translate(u'BookForm', u'Book in use "Delete" is disabled')) - self.DeleteButton.setEnabled(False) - else: - self.MessageLabel.setText(translate(u'BookForm', u'Book in not used')) - self.DeleteButton.setEnabled(True) - self._validate_form() - self.NameEdit.setFocus() - - def _validate_form(self): - # We need at lease a display name - if len(self.NameEdit.displayText()) == 0: - self.AddUpdateButton.setEnabled(False) - else: - self.AddUpdateButton.setEnabled(True) diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py index e91ce735c..ecaab5653 100644 --- a/openlp/plugins/songs/forms/songmaintenancedialog.py +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -42,7 +42,6 @@ class Ui_SongMaintenanceDialog(object): sizePolicy.setHeightForWidth(self.TypeListWidget.sizePolicy().hasHeightForWidth()) self.TypeListWidget.setSizePolicy(sizePolicy) self.TypeListWidget.setProperty("showDropIndicator", QtCore.QVariant(False)) - #self.TypeListWidget.setFlow(QtGui.QListView.TopToBottom) self.TypeListWidget.setSpacing(0) self.TypeListWidget.setViewMode(QtGui.QListView.IconMode) self.TypeListWidget.setIconSize(QtCore.QSize(128, 100)); @@ -69,23 +68,12 @@ class Ui_SongMaintenanceDialog(object): self.AuthorsPage = QtGui.QWidget() self.AuthorsPage.setObjectName("AuthorsPage") self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsPage) - self.AuthorsLayout.setSpacing(8) + self.AuthorsLayout.setSpacing(4) self.AuthorsLayout.setMargin(0) self.AuthorsLayout.setObjectName("AuthorsLayout") self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage) self.AuthorsListWidget.setObjectName("AuthorsListWidget") self.AuthorsLayout.addWidget(self.AuthorsListWidget) - self.AuthorsErrorLabel = QtGui.QLabel(self.AuthorsPage) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AuthorsErrorLabel.sizePolicy().hasHeightForWidth()) - self.AuthorsErrorLabel.setSizePolicy(sizePolicy) - self.AuthorsErrorLabel.setSize(QtCore.QSize(0, 0)) - self.AuthorsErrorLabel.setMargin(4) - self.AuthorsErrorLabel.setStyleSheet(u'background-color: #900; color: #fff;') - self.AuthorsErrorLabel.setObjectName("AuthorsErrorLabel") - self.AuthorsLayout.addWidget(self.AuthorsErrorLabel) self.AuthorButtonWidget = QtGui.QWidget(self.AuthorsPage) self.AuthorButtonWidget.setObjectName("AuthorButtonWidget") self.AuthorButtonsLayout = QtGui.QHBoxLayout(self.AuthorButtonWidget) @@ -128,13 +116,6 @@ class Ui_SongMaintenanceDialog(object): self.TopicsListWidget = QtGui.QListWidget(self.TopicsPage) self.TopicsListWidget.setObjectName("TopicsListWidget") self.TopicLayout.addWidget(self.TopicsListWidget) - self.TopicsErrorLabel = QtGui.QLabel(self.TopicsPage) - self.TopicsErrorLabel.setMaximumHeight(0) - self.TopicsErrorLabel.setMinimumHeight(0) - self.TopicsErrorLabel.setIndent(4) - self.TopicsErrorLabel.setStyleSheet(u'background-color: #900; color: #fff;') - self.TopicsErrorLabel.setObjectName("TopicsErrorLabel") - self.TopicLayout.addWidget(self.TopicsErrorLabel) self.TopicButtonWidget = QtGui.QWidget(self.TopicsPage) self.TopicButtonWidget.setObjectName("TopicButtonWidget") self.TopicButtonLayout = QtGui.QHBoxLayout(self.TopicButtonWidget) @@ -177,13 +158,6 @@ class Ui_SongMaintenanceDialog(object): self.BooksListWidget = QtGui.QListWidget(self.BooksPage) self.BooksListWidget.setObjectName("BooksListWidget") self.BookLayout.addWidget(self.BooksListWidget) - self.BooksErrorLabel = QtGui.QLabel(self.BooksPage) - self.BooksErrorLabel.setMaximumHeight(0) - self.BooksErrorLabel.setMinimumHeight(0) - self.BooksErrorLabel.setIndent(4) - self.BooksErrorLabel.setStyleSheet(u'background-color: #900; color: #fff;') - self.BooksErrorLabel.setObjectName("BooksErrorLabel") - self.BookLayout.addWidget(self.BooksErrorLabel) self.BookButtonWidget = QtGui.QWidget(self.BooksPage) self.BookButtonWidget.setObjectName("BookButtonWidget") self.BookButtonLayout = QtGui.QHBoxLayout(self.BookButtonWidget) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index c39bcd5ec..8730ad1ac 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -19,9 +19,11 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtGui, QtCore from openlp.core.lib import translate -from openlp.plugins.songs.forms import SongBookForm from openlp.plugins.songs.lib.classes import Author, Book, Topic from songmaintenancedialog import Ui_SongMaintenanceDialog +from authorsform import AuthorsForm +from topicsform import TopicsForm +from songbookform import SongBookForm class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): """ @@ -34,9 +36,21 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): QtGui.QDialog.__init__(self, parent) self.setupUi(self) self.songmanager = songmanager - self.timer = QtCore.QTimer() - QtCore.QObject.connect(self.timer, - QtCore.SIGNAL(u'timeout()'), self._hideErrors) + self.authorform = AuthorsForm(self) + self.topicform = TopicsForm(self) + self.bookform = SongBookForm(self) + QtCore.QObject.connect(self.AuthorAddButton, + QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick) + QtCore.QObject.connect(self.TopicAddButton, + QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick) + QtCore.QObject.connect(self.BookAddButton, + QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick) + QtCore.QObject.connect(self.AuthorEditButton, + QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick) + QtCore.QObject.connect(self.TopicEditButton, + QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick) + QtCore.QObject.connect(self.BookEditButton, + QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick) QtCore.QObject.connect(self.AuthorDeleteButton, QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick) QtCore.QObject.connect(self.TopicDeleteButton, @@ -59,28 +73,23 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): else: return -1 - def _showError(self, error): - self.AuthorsErrorLabel.setSize(QtCore.QSize(0, 32)) - self.AuthorsErrorLabel.setText(error) - self.TopicsErrorLabel.setMaximumHeight(32) - self.TopicsErrorLabel.setMinimumHeight(32) - self.TopicsErrorLabel.setText(error) - self.BooksErrorLabel.setMaximumHeight(32) - self.BooksErrorLabel.setMinimumHeight(32) - self.BooksErrorLabel.setText(error) - self.timer.start(2000) - - def _hideErrors(self): - self.timer.stop() - self.AuthorsErrorLabel.setMaximumHeight(0) - self.AuthorsErrorLabel.setMinimumHeight(0) - self.AuthorsErrorLabel.clear() - self.TopicsErrorLabel.setMaximumHeight(0) - self.TopicsErrorLabel.setMinimumHeight(0) - self.TopicsErrorLabel.clear() - self.BooksErrorLabel.setMaximumHeight(0) - self.BooksErrorLabel.setMinimumHeight(0) - self.BooksErrorLabel.clear() + def _deleteItem(self, list_widget, get_func, del_func, reset_func, + dlg_title, del_text, err_text, sel_text): + item_id = self._getCurrentItemId(list_widget) + if item_id != -1: + item = get_func(item_id) + if QtGui.QMessageBox.warning(self, dlg_title, del_text, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) + ) == QtGui.QMessageBox.Yes: + if item is not None and len(item.songs) == 0: + del_func(item.id) + reset_func() + else: + QtGui.QMessageBox.critical(self, dlg_title, err_text, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + else: + QtGui.QMessageBox.critical(self, dlg_title, sel_text, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) def resetAuthors(self): self.AuthorsListWidget.clear() @@ -110,72 +119,125 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id)) self.BooksListWidget.addItem(book_name) + def onAuthorAddButtonClick(self): + self.authorform.setAutoDisplayName(True) + if self.authorform.exec_(): + author = Author.populate( + first_name=unicode(self.authorform.FirstNameEdit.text(), u'utf-8'), + last_name=unicode(self.authorform.LastNameEdit.text(), u'utf-8'), + display_name=unicode(self.authorform.DisplayEdit.text(), u'utf-8')) + if self.songmanager.save_author(author): + self.resetAuthors() + else: + QtGui.QMessageBox.critical(self, + translate(u'SongMaintenanceForm', u'Error'), + translate(u'SongMaintenanceForm', u'Couldn\'t add your author!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + + def onTopicAddButtonClick(self): + if self.topicform.exec_(): + topic = Topic.populate(name=unicode(self.topicform.NameEdit.text(), u'utf-8')) + if self.songmanager.save_topic(topic): + self.resetTopics() + else: + QtGui.QMessageBox.critical(self, + translate(u'SongMaintenanceForm', u'Error'), + translate(u'SongMaintenanceForm', u'Couldn\'t add your topic!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + + def onBookAddButtonClick(self): + if self.bookform.exec_(): + book = Book.populate(name=unicode(self.bookform.NameEdit.text(), u'utf-8'), + publisher=unicode(self.bookform.PublisherEdit.text(), u'utf-8')) + if self.songmanager.save_book(book): + self.resetBooks() + else: + QtGui.QMessageBox.critical(self, + translate(u'SongMaintenanceForm', u'Error'), + translate(u'SongMaintenanceForm', u'Couldn\'t add your book!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + + def onAuthorEditButtonClick(self): + author_id = self._getCurrentItemId(self.AuthorsListWidget) + if author_id != -1: + author = self.songmanager.get_author(author_id) + self.authorform.setAutoDisplayName(False) + self.authorform.FirstNameEdit.setText(author.first_name) + self.authorform.LastNameEdit.setText(author.last_name) + self.authorform.DisplayEdit.setText(author.display_name) + if self.authorform.exec_(False): + author.first_name = unicode(self.authorform.FirstNameEdit.text(), u'utf-8') + author.last_name = unicode(self.authorform.LastNameEdit.text(), u'utf-8') + author.display_name = unicode(self.authorform.DisplayEdit.text(), u'utf-8') + if self.songmanager.save_author(author): + self.resetAuthors() + else: + QtGui.QMessageBox.critical(self, + translate(u'SongMaintenanceForm', u'Error'), + translate(u'SongMaintenanceForm', u'Couldn\'t save your author!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + + def onTopicEditButtonClick(self): + topic_id = self._getCurrentItemId(self.TopicsListWidget) + if topic_id != -1: + topic = self.songmanager.get_topic(topic_id) + self.topicform.NameEdit.setText(topic.name) + if self.topicform.exec_(False): + topic.name = unicode(self.topicform.NameEdit.text(), u'utf-8') + if self.songmanager.save_topic(topic): + self.resetTopics() + else: + QtGui.QMessageBox.critical(self, + translate(u'SongMaintenanceForm', u'Error'), + translate(u'SongMaintenanceForm', u'Couldn\'t save your topic!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + + def onBookEditButtonClick(self): + book_id = self._getCurrentItemId(self.BooksListWidget) + if book_id != -1: + book = self.songmanager.get_book(book_id) + self.bookform.NameEdit.setText(book.name) + self.bookform.PublisherEdit.setText(book.publisher) + if self.bookform.exec_(False): + book.name = unicode(self.bookform.NameEdit.text(), u'utf-8') + book.publisher = unicode(self.bookform.PublisherEdit.text(), u'utf-8') + if self.songmanager.save_book(book): + self.resetBooks() + else: + QtGui.QMessageBox.critical(self, + translate(u'SongMaintenanceForm', u'Error'), + translate(u'SongMaintenanceForm', u'Couldn\'t save your book!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + def onAuthorDeleteButtonClick(self): """ Delete the author if the author is not attached to any songs """ - author_id = self._getCurrentItemId(self.AuthorsListWidget) - if author_id != -1: - author = self.songmanager.get_author(author_id) - if QtGui.QMessageBox.warning(None, - translate(u'SongMaintenanceForm', u'Delete Author'), - translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected author?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) - ) == QtGui.QMessageBox.Yes: - if len(author.songs) == 0: - self.songmanager.delete_author(author.id) - self.resetAuthors() - else: - QtGui.QMessageBox.critical(None, - translate(u'SongMaintenanceForm', u'Delete Author'), - translate(u'SongMaintenanceForm', u'This author can\'t be deleted, they are currently assigned to at least one song!'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) - else: - self._showError(translate(u'SongMaintenanceForm', u'No author selected!')) + self._deleteItem(self.AuthorsListWidget, self.songmanager.get_author, + self.songmanager.delete_author, self.resetAuthors, + translate(u'SongMaintenanceForm', u'Delete Author'), + translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected author?'), + translate(u'SongMaintenanceForm', u'This author can\'t be deleted, they are currently assigned to at least one song!'), + translate(u'SongMaintenanceForm', u'No author selected!')) def onTopicDeleteButtonClick(self): """ Delete the Book is the Book is not attached to any songs """ - topic_id = self._getCurrentItemId(self.TopicsListWidget) - if topic_id != -1: - topic = self.songmanager.get_topic(topic_id) - if QtGui.QMessageBox.warning(None, - translate(u'SongMaintenanceForm', u'Delete Topic'), - translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected topic?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) - ) == QtGui.QMessageBox.Yes: - if len(topic.songs) == 0: - self.songmanager.delete_topic(topic.id) - self.resetTopics() - else: - #QtGui.QMessageBox.critical(None, - # translate(u'SongMaintenanceForm', u'Delete Topic'), - # translate(u'SongMaintenanceForm', u'This topic can\'t be deleted, it is currently assigned to at least one song!'), - # QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) - self._showError(translate(u'SongMaintenanceForm', u'This topic can\'t be deleted, it is currently assigned to at least one song!')) - else: - self._showError(translate(u'SongMaintenanceForm', u'No topic selected!')) + self._deleteItem(self.TopicsListWidget, self.songmanager.get_topic, + self.songmanager.delete_topic, self.resetTopics, + translate(u'SongMaintenanceForm', u'Delete Topic'), + translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected topic?'), + translate(u'SongMaintenanceForm', u'This topic can\'t be deleted, it is currently assigned to at least one song!'), + translate(u'SongMaintenanceForm', u'No topic selected!')) def onBookDeleteButtonClick(self): """ Delete the Book is the Book is not attached to any songs """ - book_id = self._getCurrentItemId(self.BooksListWidget) - if book_id != -1: - book = self.songmanager.get_book(book_id) - if QtGui.QMessageBox.warning(None, - translate(u'SongMaintenanceForm', u'Delete Book'), - translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected book?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) - ) == QtGui.QMessageBox.Yes: - if len(book.songs) == 0: - self.songmanager.delete_book(book.id) - self.resetBooks() - else: - QtGui.QMessageBox.critical(None, - translate(u'SongMaintenanceForm', u'Delete Book'), - translate(u'SongMaintenanceForm', u'This book can\'t be deleted, it is currently assigned to at least one song!'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) - else: - self._showError(translate(u'SongMaintenanceForm', u'No book selected!')) + self._deleteItem(self.BooksListWidget, self.songmanager.get_book, + self.songmanager.delete_book, self.resetBooks, + translate(u'SongMaintenanceForm', u'Delete Book'), + translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected book?'), + translate(u'SongMaintenanceForm', u'This book can\'t be deleted, it is currently assigned to at least one song!'), + translate(u'SongMaintenanceForm', u'No book selected!')) diff --git a/openlp/plugins/songs/forms/topicsdialog.py b/openlp/plugins/songs/forms/topicsdialog.py index 2a56837fa..589fb8ccc 100644 --- a/openlp/plugins/songs/forms/topicsdialog.py +++ b/openlp/plugins/songs/forms/topicsdialog.py @@ -22,67 +22,32 @@ from openlp.core.lib import translate class Ui_TopicsDialog(object): def setupUi(self, TopicsDialog): - TopicsDialog.setObjectName(u'TopicsDialog') - TopicsDialog.resize(387, 463) - self.gridLayout_2 = QtGui.QGridLayout(TopicsDialog) - self.gridLayout_2.setObjectName(u'gridLayout_2') - self.TopicGroupBox = QtGui.QGroupBox(TopicsDialog) - self.TopicGroupBox.setObjectName(u'TopicGroupBox') - self.gridLayout = QtGui.QGridLayout(self.TopicGroupBox) - self.gridLayout.setObjectName(u'gridLayout') - self.TopicNameLabel = QtGui.QLabel(self.TopicGroupBox) - self.TopicNameLabel.setObjectName(u'TopicNameLabel') - self.gridLayout.addWidget(self.TopicNameLabel, 0, 0, 1, 1) - self.TopicNameEdit = QtGui.QLineEdit(self.TopicGroupBox) - self.TopicNameEdit.setObjectName(u'TopicNameEdit') - self.gridLayout.addWidget(self.TopicNameEdit, 0, 1, 1, 4) - spacerItem = QtGui.QSpacerItem(198, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.gridLayout.addItem(spacerItem, 1, 0, 1, 2) - self.DeleteButton = QtGui.QPushButton(self.TopicGroupBox) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/services/service_delete.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.DeleteButton.setIcon(icon) - self.DeleteButton.setObjectName(u'DeleteButton') - self.gridLayout.addWidget(self.DeleteButton, 1, 3, 1, 1) - self.AddUpdateButton = QtGui.QPushButton(self.TopicGroupBox) - icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(u':/services/service_save.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.AddUpdateButton.setIcon(icon1) - self.AddUpdateButton.setObjectName(u'AddUpdateButton') - self.gridLayout.addWidget(self.AddUpdateButton, 1, 4, 1, 1) - self.ClearButton = QtGui.QPushButton(self.TopicGroupBox) - icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(u':/services/service_new.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.ClearButton.setIcon(icon2) - self.ClearButton.setObjectName(u'ClearButton') - self.gridLayout.addWidget(self.ClearButton, 1, 2, 1, 1) - self.gridLayout_2.addWidget(self.TopicGroupBox, 1, 0, 1, 1) - self.MessageLabel = QtGui.QLabel(TopicsDialog) - self.MessageLabel.setObjectName(u'MessageLabel') - self.gridLayout_2.addWidget(self.MessageLabel, 3, 0, 1, 1) - self.TopicsListWidget = QtGui.QListWidget() - self.TopicsListWidget.setAlternatingRowColors(True) - self.gridLayout_2.addWidget(self.TopicsListWidget, 0, 0, 1, 1) - self.ButtonBox = QtGui.QDialogButtonBox(TopicsDialog) - self.ButtonBox.setOrientation(QtCore.Qt.Horizontal) - self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) - self.ButtonBox.setObjectName(u'ButtonBox') - self.gridLayout_2.addWidget(self.ButtonBox, 2, 0, 1, 1) + TopicsDialog.setObjectName("TopicsDialog") + TopicsDialog.resize(365, 77) + self.TopicLayout = QtGui.QFormLayout(TopicsDialog) + self.TopicLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) + self.TopicLayout.setMargin(8) + self.TopicLayout.setSpacing(8) + self.TopicLayout.setObjectName("TopicLayout") + self.NameLabel = QtGui.QLabel(TopicsDialog) + self.NameLabel.setObjectName("NameLabel") + self.TopicLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.NameLabel) + self.NameEdit = QtGui.QLineEdit(TopicsDialog) + self.NameEdit.setObjectName("NameEdit") + self.TopicLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.NameEdit) + self.TopicButtonBox = QtGui.QDialogButtonBox(TopicsDialog) + self.TopicButtonBox.setOrientation(QtCore.Qt.Horizontal) + self.TopicButtonBox.setStandardButtons( + QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) + self.TopicButtonBox.setObjectName("TopicButtonBox") + self.TopicLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.TopicButtonBox) self.retranslateUi(TopicsDialog) - QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), TopicsDialog.accept) - QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), TopicsDialog.reject) + QtCore.QObject.connect(self.TopicButtonBox, QtCore.SIGNAL("accepted()"), TopicsDialog.accept) + QtCore.QObject.connect(self.TopicButtonBox, QtCore.SIGNAL("rejected()"), TopicsDialog.reject) QtCore.QMetaObject.connectSlotsByName(TopicsDialog) def retranslateUi(self, TopicsDialog): - TopicsDialog.setWindowTitle(translate(u'TopicsDialog', u'Topic Maintenance')) - self.TopicGroupBox.setTitle(translate(u'TopicsDialog', u'Topic')) - self.TopicNameLabel.setText(translate(u'TopicsDialog', u'Topic Name:')) - - self.DeleteButton.setToolTip(translate(u'TopicsDialog', u'Delete Author')) - self.DeleteButton.setText(translate(u'AuthorsDialog', u'Delete')) - self.AddUpdateButton.setToolTip(translate(u'TopicsDialog', u'Add Update Author')) - self.AddUpdateButton.setText(translate(u'AuthorsDialog', u'Save')) - self.ClearButton.setToolTip(translate(u'TopicsDialog', u'Clear Selection')) - self.ClearButton.setText(translate(u'TopicsDialog', u'Clear')) + TopicsDialog.setWindowTitle(QtGui.QApplication.translate("TopicsDialog", "Topic Maintenance", None, QtGui.QApplication.UnicodeUTF8)) + self.NameLabel.setText(QtGui.QApplication.translate("TopicsDialog", "Topic Name:", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/plugins/songs/forms/topicsform.py b/openlp/plugins/songs/forms/topicsform.py index 825d1a66b..810bf760f 100644 --- a/openlp/plugins/songs/forms/topicsform.py +++ b/openlp/plugins/songs/forms/topicsform.py @@ -18,110 +18,22 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtGui, QtCore from openlp.core.lib import translate -from openlp.plugins.songs.forms.topicsdialog import Ui_TopicsDialog -from openlp.plugins.songs.lib.classes import Topic +from topicsdialog import Ui_TopicsDialog class TopicsForm(QtGui.QDialog, Ui_TopicsDialog): """ Class documentation goes here. """ - def __init__(self, songmanager, parent = None): + def __init__(self, parent=None): """ Constructor """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self.songmanager = songmanager - self.currentRow = 0 - self.topic = None - QtCore.QObject.connect(self.DeleteButton, - QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick) - QtCore.QObject.connect(self.ClearButton, - QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick) - QtCore.QObject.connect(self.AddUpdateButton, - QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick) - QtCore.QObject.connect(self.TopicNameEdit, - QtCore.SIGNAL(u'lostFocus()'), self.onTopicNameEditLostFocus) - QtCore.QObject.connect(self.TopicsListWidget, - QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onTopicsListWidgetItemClicked) + def exec_(self, clear=True): + if clear: + self.NameEdit.clear() + self.NameEdit.setFocus() + return QtGui.QDialog.exec_(self) - def load_form(self): - """ - Refresh the screen and rest fields - """ - self.TopicsListWidget.clear() - # tidy up screen - self.onClearButtonClick() - topics = self.songmanager.get_topics() - for topic in topics: - topic_name = QtGui.QListWidgetItem(topic.name) - topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id)) - self.TopicsListWidget.addItem(topic_name) - if self.currentRow >= self.TopicsListWidget.count() : - self.TopicsListWidget.setCurrentRow(self.TopicsListWidget.count() - 1) - else: - self.TopicsListWidget.setCurrentRow(self.currentRow) - self._validate_form() - - def onDeleteButtonClick(self): - """ - Delete the Topic is the Topic is not attached to any songs - """ - self.songmanager.delete_topic(self.topic.id) - self.load_form() - - def onTopicNameEditLostFocus(self): - self._validate_form() - - def onAddUpdateButtonClick(self): - """ - Sent New or update details to the database - """ - if self._validate_form(): - if self.topic == None: - self.topic = Topic() - self.topic.name = unicode(self.TopicNameEdit.displayText()) - self.songmanager.save_topic(self.topic) - self.onClearButtonClick() - self.load_form() - - def onClearButtonClick(self): - """ - Tidy up screen if clear button pressed - """ - self.TopicNameEdit.setText(u'') - self.MessageLabel.setText(u'') - self.DeleteButton.setEnabled(False) - self.topic = None - self._validate_form() - self.TopicNameEdit.setFocus() - - def onTopicsListWidgetItemClicked(self, index): - """ - An Topic has been selected display it - If the Topic is attached to a Song prevent delete - """ - self.currentRow = self.TopicsListWidget.currentRow() - item = self.TopicsListWidget.currentItem() - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - self.topic = self.songmanager.get_topic(item_id) - self.TopicNameEdit.setText(self.topic.name) - if len(self.topic.songs) > 0: - self.MessageLabel.setText(translate(u'TopicForm', u'Topic in use "Delete" is disabled')) - self.DeleteButton.setEnabled(False) - else: - self.MessageLabel.setText(translate(u'TopicForm', u'Topic in not used')) - self.DeleteButton.setEnabled(True) - self._validate_form() - self.TopicNameEdit.setFocus() - - def _validate_form(self): - # We need at lease a display name - valid = True - if len(self.TopicNameEdit.displayText()) == 0: - valid = False - self.TopicNameEdit.setStyleSheet(u'background-color: red; color: white') - else: - self.TopicNameEdit.setStyleSheet(u'') - return valid diff --git a/openlp/plugins/songs/lib/classes.py b/openlp/plugins/songs/lib/classes.py index a693641d3..49dcd6dc1 100644 --- a/openlp/plugins/songs/lib/classes.py +++ b/openlp/plugins/songs/lib/classes.py @@ -43,7 +43,8 @@ class Book(BaseModel): """ Book model """ - pass + def __repr__(self): + return u'' % (str(self.id), self.name, self.publisher) class Song(BaseModel): """ diff --git a/openlp/plugins/songs/lib/manager.py b/openlp/plugins/songs/lib/manager.py index 8775a51b1..a3ad8423a 100644 --- a/openlp/plugins/songs/lib/manager.py +++ b/openlp/plugins/songs/lib/manager.py @@ -218,9 +218,9 @@ class SongManager(): self.session.add(book) self.session.commit() return True - except: + except Exception, e: self.session.rollback() - log.error(u'Errow thrown %s', sys.exc_info()[1]) + log.error(u'Errow thrown %s', e.args[0]) return False def delete_book(self, bookid): diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 5b9dbae38..826bbb786 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -60,10 +60,10 @@ class SongMediaItem(MediaManagerItem): self.ConfigSection = u'song' MediaManagerItem.__init__(self, parent, icon, title) self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager) - self.authors_form = AuthorsForm(self.parent.songmanager) - self.topics_form = TopicsForm(self.parent.songmanager) - self.song_book_form = SongBookForm(self.parent.songmanager) - self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager) + #self.authors_form = AuthorsForm(self.parent.songmanager) + #self.topics_form = TopicsForm(self.parent.songmanager) + #self.song_book_form = SongBookForm(self.parent.songmanager) + self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self) def setupUi(self): # Add a toolbar diff --git a/openlp/plugins/songs/lib/models.py b/openlp/plugins/songs/lib/models.py index a609adf99..6f518b8c0 100644 --- a/openlp/plugins/songs/lib/models.py +++ b/openlp/plugins/songs/lib/models.py @@ -27,8 +27,8 @@ from openlp.plugins.songs.lib.classes import * def init_models(url): engine = create_engine(url) metadata.bind = engine - session = scoped_session(sessionmaker(autoflush=True, autocommit=False, - bind=engine)) + session = scoped_session(sessionmaker(autoflush=True, + autocommit=False, bind=engine)) mapper(Author, authors_table) mapper(Book, song_books_table) mapper(Song, songs_table, diff --git a/openlp/plugins/songs/lib/tables.py b/openlp/plugins/songs/lib/tables.py index 617c53b7d..b8fe0eeb0 100644 --- a/openlp/plugins/songs/lib/tables.py +++ b/openlp/plugins/songs/lib/tables.py @@ -31,7 +31,7 @@ authors_table = Table(u'authors', metadata, # Definition of the "song_books" table song_books_table = Table(u'song_books', metadata, - Column(u'id', types.Integer, primary_key=True), + Column(u'id', types.Integer, primary_key=True), Column(u'name', types.Unicode(128), nullable=False), Column(u'publisher', types.Unicode(128)) ) diff --git a/resources/forms/authorsdialog.ui b/resources/forms/authorsdialog.ui index 4be1ef2a7..41810b539 100644 --- a/resources/forms/authorsdialog.ui +++ b/resources/forms/authorsdialog.ui @@ -1,229 +1,104 @@ - + + AuthorsDialog - - + + 0 0 - 410 - 505 + 393 + 147 - + Author Maintenance - - + + 8 - + 8 - - - - true - - - true - - - 0 + + 8 + + + + + + + + + + + Display Name: - - - - - 0 - 0 - + + + + First Name: - - Author Details - - - - 8 - - - 8 - - - - - - 8 - - - 8 - - - 0 - - - - - Display Name: - - - - - - - - - - First Name: - - - - - - - - - - Last Name: - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 8 - - - 0 - - - - - Qt::Horizontal - - - - 198 - 20 - - - - - - - - Clear Selection - - - New - - - - :/services/service_new.png:/services/service_new.png - - - - - - - Add Update Author - - - Save - - - - :/services/service_save.png:/services/service_save.png - - - - - - - Delete Author - - - Delete - - - - :/services/service_delete.png:/services/service_delete.png - - - - - - - - - - + + + Exit Screen - + Qt::Horizontal - - QDialogButtonBox::Ok + + QDialogButtonBox::Cancel|QDialogButtonBox::Save + + + + + + + + + + Last Name: - + - buttonBox + AuthorButtonBox accepted() AuthorsDialog accept() - + 248 254 - + 157 274 - buttonBox + AuthorButtonBox rejected() AuthorsDialog reject() - + 316 260 - + 286 274 diff --git a/resources/forms/songbookdialog.ui b/resources/forms/songbookdialog.ui index 54476ce98..f29d5fa14 100644 --- a/resources/forms/songbookdialog.ui +++ b/resources/forms/songbookdialog.ui @@ -1,195 +1,62 @@ - + + SongBookDialog - - + + 0 0 - 387 - 531 + 367 + 120 - + Book Song Maintenance - - + + 8 - + 8 - - - - - - - - 0 - 200 - + + 8 + + + + + Name: - - Song Book - - - - 8 - - - 8 - - - - - - 0 - 0 - - - - - 8 - - - 8 - - - 0 - - - - - Name: - - - - - - - - - - Publisher: - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 8 - - - 0 - - - - - Qt::Horizontal - - - - 61 - 24 - - - - - - - - Clear Selection - - - New - - - - :/services/service_new.png:/services/service_new.png - - - - - - - Add Update Author - - - Save - - - - :/services/service_save.png:/services/service_save.png - - - - - - - Delete Author - - - Delete - - - - :/services/service_delete.png:/services/service_delete.png - - - - - - - - - - + + + + + + + Publisher: + + + + + + + + + Qt::Horizontal - - QDialogButtonBox::Ok + + QDialogButtonBox::Cancel|QDialogButtonBox::Save - + @@ -198,11 +65,11 @@ SongBookDialog accept() - + 248 254 - + 157 274 @@ -214,11 +81,11 @@ SongBookDialog reject() - + 316 260 - + 286 274 diff --git a/resources/forms/topicsdialog.ui b/resources/forms/topicsdialog.ui index 768681e33..ffee5761f 100644 --- a/resources/forms/topicsdialog.ui +++ b/resources/forms/topicsdialog.ui @@ -1,158 +1,52 @@ - + + TopicsDialog - - + + 0 0 - 471 - 470 + 365 + 77 - + Topic Maintenance - - + + + QFormLayout::ExpandingFieldsGrow + + 8 - + 8 - - - - Topic Details - - - - 8 - - - 8 - - - - - Topic Name: - - - - - - - - - - Qt::Horizontal - - - - 198 - 20 - - - - - - - - Delete Author - - - Delete - - - - :/services/service_delete.png:/services/service_delete.png - - - - - - - Add Update Author - - - Save - - - - :/services/service_save.png:/services/service_save.png - - - - - - - Clear Selection - - - New - - - - :/services/service_new.png:/services/service_new.png - - - - - - - - - - true + + 8 + + + + + Topic Name: - - - - Qt::Horizontal - - - QDialogButtonBox::Ok + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Save - + - - - ButtonBox - accepted() - TopicsDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - ButtonBox - rejected() - TopicsDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - + From 6cb9222abaf4489f9c9ef121130c14eafdfabdf7 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 25 Jul 2009 00:13:40 +0200 Subject: [PATCH 4/7] Last few touches to the song maintenance. --- openlp/plugins/songs/forms/authorsdialog.py | 61 +++--- openlp/plugins/songs/forms/songbookdialog.py | 44 +++-- .../songs/forms/songmaintenancedialog.py | 179 ++++++++++-------- .../songs/forms/songmaintenanceform.py | 3 +- openlp/plugins/songs/forms/topicsdialog.py | 34 ++-- openlp/plugins/songs/lib/mediaitem.py | 17 +- resources/forms/songmaintenance.ui | 12 -- resources/images/openlp-2.qrc | 1 + resources/images/song_maintenance.png | Bin 0 -> 719 bytes 9 files changed, 193 insertions(+), 158 deletions(-) create mode 100644 resources/images/song_maintenance.png diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index d56eaa663..4e631b664 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -22,44 +22,57 @@ from openlp.core.lib import translate class Ui_AuthorsDialog(object): def setupUi(self, AuthorsDialog): - AuthorsDialog.setObjectName("AuthorsDialog") + AuthorsDialog.setObjectName(u'AuthorsDialog') AuthorsDialog.resize(393, 147) self.AuthorsLayout = QtGui.QFormLayout(AuthorsDialog) self.AuthorsLayout.setMargin(8) self.AuthorsLayout.setSpacing(8) - self.AuthorsLayout.setObjectName("AuthorsLayout") + self.AuthorsLayout.setObjectName(u'AuthorsLayout') self.FirstNameLabel = QtGui.QLabel(AuthorsDialog) - self.FirstNameLabel.setObjectName("FirstNameLabel") - self.AuthorsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FirstNameLabel) + self.FirstNameLabel.setObjectName(u'FirstNameLabel') + self.AuthorsLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.FirstNameLabel) self.FirstNameEdit = QtGui.QLineEdit(AuthorsDialog) - self.FirstNameEdit.setObjectName("FirstNameEdit") - self.AuthorsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FirstNameEdit) + self.FirstNameEdit.setObjectName(u'FirstNameEdit') + self.AuthorsLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.FirstNameEdit) self.LastNameLabel = QtGui.QLabel(AuthorsDialog) - self.LastNameLabel.setObjectName("LastNameLabel") - self.AuthorsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.LastNameLabel) + self.LastNameLabel.setObjectName(u'LastNameLabel') + self.AuthorsLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.LastNameLabel) self.LastNameEdit = QtGui.QLineEdit(AuthorsDialog) - self.LastNameEdit.setObjectName("LastNameEdit") - self.AuthorsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.LastNameEdit) + self.LastNameEdit.setObjectName(u'LastNameEdit') + self.AuthorsLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.LastNameEdit) self.DisplayLabel = QtGui.QLabel(AuthorsDialog) - self.DisplayLabel.setObjectName("DisplayLabel") - self.AuthorsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.DisplayLabel) + self.DisplayLabel.setObjectName(u'DisplayLabel') + self.AuthorsLayout.setWidget(2, + QtGui.QFormLayout.LabelRole, self.DisplayLabel) self.DisplayEdit = QtGui.QLineEdit(AuthorsDialog) - self.DisplayEdit.setObjectName("DisplayEdit") - self.AuthorsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.DisplayEdit) + self.DisplayEdit.setObjectName(u'DisplayEdit') + self.AuthorsLayout.setWidget(2, + QtGui.QFormLayout.FieldRole, self.DisplayEdit) self.AuthorButtonBox = QtGui.QDialogButtonBox(AuthorsDialog) self.AuthorButtonBox.setOrientation(QtCore.Qt.Horizontal) - self.AuthorButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) - self.AuthorButtonBox.setObjectName("AuthorButtonBox") - self.AuthorsLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.AuthorButtonBox) + self.AuthorButtonBox.setStandardButtons( + QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) + self.AuthorButtonBox.setObjectName(u'AuthorButtonBox') + self.AuthorsLayout.setWidget(3, + QtGui.QFormLayout.FieldRole, self.AuthorButtonBox) self.retranslateUi(AuthorsDialog) - QtCore.QObject.connect(self.AuthorButtonBox, QtCore.SIGNAL("accepted()"), AuthorsDialog.accept) - QtCore.QObject.connect(self.AuthorButtonBox, QtCore.SIGNAL("rejected()"), AuthorsDialog.reject) + QtCore.QObject.connect(self.AuthorButtonBox, + QtCore.SIGNAL(u'accepted()'), AuthorsDialog.accept) + QtCore.QObject.connect(self.AuthorButtonBox, + QtCore.SIGNAL(u'rejected()'), AuthorsDialog.reject) QtCore.QMetaObject.connectSlotsByName(AuthorsDialog) def retranslateUi(self, AuthorsDialog): - AuthorsDialog.setWindowTitle(QtGui.QApplication.translate("AuthorsDialog", "Author Maintenance", None, QtGui.QApplication.UnicodeUTF8)) - self.DisplayLabel.setText(QtGui.QApplication.translate("AuthorsDialog", "Display Name:", None, QtGui.QApplication.UnicodeUTF8)) - self.FirstNameLabel.setText(QtGui.QApplication.translate("AuthorsDialog", "First Name:", None, QtGui.QApplication.UnicodeUTF8)) - self.AuthorButtonBox.setToolTip(QtGui.QApplication.translate("AuthorsDialog", "Exit Screen", None, QtGui.QApplication.UnicodeUTF8)) - self.LastNameLabel.setText(QtGui.QApplication.translate("AuthorsDialog", "Last Name:", None, QtGui.QApplication.UnicodeUTF8)) + AuthorsDialog.setWindowTitle( + translate(u'AuthorsDialog', u'Author Maintenance')) + self.DisplayLabel.setText( + translate(u'AuthorsDialog', u'Display name:')) + self.FirstNameLabel.setText( + translate(u'AuthorsDialog', u'First name:')) + self.LastNameLabel.setText( + translate(u'AuthorsDialog', u'Last name:')) diff --git a/openlp/plugins/songs/forms/songbookdialog.py b/openlp/plugins/songs/forms/songbookdialog.py index fdeccb06d..6cd1a5abc 100644 --- a/openlp/plugins/songs/forms/songbookdialog.py +++ b/openlp/plugins/songs/forms/songbookdialog.py @@ -22,37 +22,47 @@ from openlp.core.lib import translate class Ui_SongBookDialog(object): def setupUi(self, SongBookDialog): - SongBookDialog.setObjectName("SongBookDialog") + SongBookDialog.setObjectName(u'SongBookDialog') SongBookDialog.resize(367, 120) self.SongBookLayout = QtGui.QFormLayout(SongBookDialog) self.SongBookLayout.setMargin(8) self.SongBookLayout.setSpacing(8) - self.SongBookLayout.setObjectName("SongBookLayout") + self.SongBookLayout.setObjectName(u'SongBookLayout') self.NameLabel = QtGui.QLabel(SongBookDialog) - self.NameLabel.setObjectName("NameLabel") - self.SongBookLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.NameLabel) + self.NameLabel.setObjectName(u'NameLabel') + self.SongBookLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.NameLabel) self.NameEdit = QtGui.QLineEdit(SongBookDialog) - self.NameEdit.setObjectName("NameEdit") - self.SongBookLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.NameEdit) + self.NameEdit.setObjectName(u'NameEdit') + self.SongBookLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.NameEdit) self.PublisherLabel = QtGui.QLabel(SongBookDialog) - self.PublisherLabel.setObjectName("PublisherLabel") - self.SongBookLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.PublisherLabel) + self.PublisherLabel.setObjectName(u'PublisherLabel') + self.SongBookLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.PublisherLabel) self.PublisherEdit = QtGui.QLineEdit(SongBookDialog) - self.PublisherEdit.setObjectName("PublisherEdit") - self.SongBookLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.PublisherEdit) + self.PublisherEdit.setObjectName(u'PublisherEdit') + self.SongBookLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.PublisherEdit) self.ButtonBox = QtGui.QDialogButtonBox(SongBookDialog) self.ButtonBox.setOrientation(QtCore.Qt.Horizontal) self.ButtonBox.setStandardButtons( QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) - self.ButtonBox.setObjectName("ButtonBox") - self.SongBookLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.ButtonBox) + self.ButtonBox.setObjectName(u'ButtonBox') + self.SongBookLayout.setWidget(2, + QtGui.QFormLayout.FieldRole, self.ButtonBox) self.retranslateUi(SongBookDialog) - QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), SongBookDialog.accept) - QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("rejected()"), SongBookDialog.reject) + QtCore.QObject.connect(self.ButtonBox, + QtCore.SIGNAL(u'accepted()'), SongBookDialog.accept) + QtCore.QObject.connect(self.ButtonBox, + QtCore.SIGNAL(u'rejected()'), SongBookDialog.reject) QtCore.QMetaObject.connectSlotsByName(SongBookDialog) def retranslateUi(self, SongBookDialog): - SongBookDialog.setWindowTitle(QtGui.QApplication.translate("SongBookDialog", "Edit Book", None, QtGui.QApplication.UnicodeUTF8)) - self.NameLabel.setText(QtGui.QApplication.translate("SongBookDialog", "Name:", None, QtGui.QApplication.UnicodeUTF8)) - self.PublisherLabel.setText(QtGui.QApplication.translate("SongBookDialog", "Publisher:", None, QtGui.QApplication.UnicodeUTF8)) + SongBookDialog.setWindowTitle( + translate(u'SongBookDialog', u'Edit Book')) + self.NameLabel.setText( + translate(u'SongBookDialog', u'Name:')) + self.PublisherLabel.setText( + translate(u'SongBookDialog', u'Publisher:')) diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py index ecaab5653..5aff9053e 100644 --- a/openlp/plugins/songs/forms/songmaintenancedialog.py +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -22,173 +22,189 @@ from openlp.core.lib import translate class Ui_SongMaintenanceDialog(object): def setupUi(self, SongMaintenanceDialog): - SongMaintenanceDialog.setObjectName("SongMaintenanceDialog") + SongMaintenanceDialog.setObjectName(u'SongMaintenanceDialog') SongMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal) SongMaintenanceDialog.resize(486, 361) self.DialogLayout = QtGui.QVBoxLayout(SongMaintenanceDialog) self.DialogLayout.setSpacing(8) self.DialogLayout.setMargin(8) - self.DialogLayout.setObjectName("DialogLayout") + self.DialogLayout.setObjectName(u'DialogLayout') self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog) - self.ContentWidget.setObjectName("ContentWidget") + self.ContentWidget.setObjectName(u'ContentWidget') self.ContentLayout = QtGui.QHBoxLayout(self.ContentWidget) self.ContentLayout.setSpacing(8) self.ContentLayout.setMargin(0) - self.ContentLayout.setObjectName("ContentLayout") + self.ContentLayout.setObjectName(u'ContentLayout') self.TypeListWidget = QtGui.QListWidget(self.ContentWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.TypeListWidget.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.TypeListWidget.sizePolicy().hasHeightForWidth()) self.TypeListWidget.setSizePolicy(sizePolicy) - self.TypeListWidget.setProperty("showDropIndicator", QtCore.QVariant(False)) - self.TypeListWidget.setSpacing(0) self.TypeListWidget.setViewMode(QtGui.QListView.IconMode) - self.TypeListWidget.setIconSize(QtCore.QSize(128, 100)); + self.TypeListWidget.setIconSize(QtCore.QSize(112, 100)); self.TypeListWidget.setMovement(QtGui.QListView.Static); - self.TypeListWidget.setMaximumWidth(128); + self.TypeListWidget.setMaximumWidth(118); self.TypeListWidget.setSpacing(3); + self.TypeListWidget.setSortingEnabled(False) self.TypeListWidget.setUniformItemSizes(True) - self.TypeListWidget.setObjectName("TypeListWidget") + self.TypeListWidget.setObjectName(u'TypeListWidget') icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(":/songs/author_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap(QtGui.QPixmap(u':/songs/author_maintenance.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) item = QtGui.QListWidgetItem(self.TypeListWidget) item.setIcon(icon) icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(":/songs/topic_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap(u':/songs/topic_maintenance.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) item = QtGui.QListWidgetItem(self.TypeListWidget) item.setIcon(icon1) icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(":/songs/book_maintenance.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon2.addPixmap(QtGui.QPixmap(u':/songs/book_maintenance.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) item = QtGui.QListWidgetItem(self.TypeListWidget) item.setIcon(icon2) self.ContentLayout.addWidget(self.TypeListWidget) self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget) - self.TypeStackedWidget.setObjectName("TypeStackedWidget") + self.TypeStackedWidget.setObjectName(u'TypeStackedWidget') self.AuthorsPage = QtGui.QWidget() - self.AuthorsPage.setObjectName("AuthorsPage") + self.AuthorsPage.setObjectName(u'AuthorsPage') self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsPage) self.AuthorsLayout.setSpacing(4) self.AuthorsLayout.setMargin(0) - self.AuthorsLayout.setObjectName("AuthorsLayout") + self.AuthorsLayout.setObjectName(u'AuthorsLayout') self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage) - self.AuthorsListWidget.setObjectName("AuthorsListWidget") + self.AuthorsListWidget.setObjectName(u'AuthorsListWidget') self.AuthorsLayout.addWidget(self.AuthorsListWidget) self.AuthorButtonWidget = QtGui.QWidget(self.AuthorsPage) - self.AuthorButtonWidget.setObjectName("AuthorButtonWidget") + self.AuthorButtonWidget.setObjectName(u'AuthorButtonWidget') self.AuthorButtonsLayout = QtGui.QHBoxLayout(self.AuthorButtonWidget) self.AuthorButtonsLayout.setSpacing(8) self.AuthorButtonsLayout.setMargin(0) - self.AuthorButtonsLayout.setObjectName("AuthorButtonsLayout") - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.AuthorButtonsLayout.setObjectName(u'AuthorButtonsLayout') + spacerItem = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.AuthorButtonsLayout.addItem(spacerItem) self.AuthorAddButton = QtGui.QPushButton(self.AuthorButtonWidget) icon3 = QtGui.QIcon() - icon3.addPixmap(QtGui.QPixmap(":/songs/author_add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon3.addPixmap(QtGui.QPixmap(u':/songs/author_add.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.AuthorAddButton.setIcon(icon3) - self.AuthorAddButton.setObjectName("AuthorAddButton") + self.AuthorAddButton.setObjectName(u'AuthorAddButton') self.AuthorButtonsLayout.addWidget(self.AuthorAddButton) self.AuthorEditButton = QtGui.QPushButton(self.AuthorButtonWidget) icon4 = QtGui.QIcon() - icon4.addPixmap(QtGui.QPixmap(":/songs/author_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon4.addPixmap(QtGui.QPixmap(u':/songs/author_edit.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.AuthorEditButton.setIcon(icon4) - self.AuthorEditButton.setObjectName("AuthorEditButton") + self.AuthorEditButton.setObjectName(u'AuthorEditButton') self.AuthorButtonsLayout.addWidget(self.AuthorEditButton) self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorButtonWidget) icon5 = QtGui.QIcon() - icon5.addPixmap(QtGui.QPixmap(":/songs/author_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon5.addPixmap(QtGui.QPixmap(u':/songs/author_delete.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.AuthorDeleteButton.setIcon(icon5) - self.AuthorDeleteButton.setObjectName("AuthorDeleteButton") + self.AuthorDeleteButton.setObjectName(u'AuthorDeleteButton') self.AuthorButtonsLayout.addWidget(self.AuthorDeleteButton) self.AuthorsLayout.addWidget(self.AuthorButtonWidget) self.AuthorsLine = QtGui.QFrame(self.AuthorsPage) self.AuthorsLine.setFrameShape(QtGui.QFrame.HLine) self.AuthorsLine.setFrameShadow(QtGui.QFrame.Sunken) - self.AuthorsLine.setObjectName("AuthorsLine") + self.AuthorsLine.setObjectName(u'AuthorsLine') self.AuthorsLayout.addWidget(self.AuthorsLine) self.TypeStackedWidget.addWidget(self.AuthorsPage) self.TopicsPage = QtGui.QWidget() - self.TopicsPage.setObjectName("TopicsPage") + self.TopicsPage.setObjectName(u'TopicsPage') self.TopicLayout = QtGui.QVBoxLayout(self.TopicsPage) self.TopicLayout.setSpacing(4) self.TopicLayout.setMargin(0) - self.TopicLayout.setObjectName("TopicLayout") + self.TopicLayout.setObjectName(u'TopicLayout') self.TopicsListWidget = QtGui.QListWidget(self.TopicsPage) - self.TopicsListWidget.setObjectName("TopicsListWidget") + self.TopicsListWidget.setObjectName(u'TopicsListWidget') self.TopicLayout.addWidget(self.TopicsListWidget) self.TopicButtonWidget = QtGui.QWidget(self.TopicsPage) - self.TopicButtonWidget.setObjectName("TopicButtonWidget") + self.TopicButtonWidget.setObjectName(u'TopicButtonWidget') self.TopicButtonLayout = QtGui.QHBoxLayout(self.TopicButtonWidget) self.TopicButtonLayout.setSpacing(8) self.TopicButtonLayout.setMargin(0) - self.TopicButtonLayout.setObjectName("TopicButtonLayout") - spacerItem1 = QtGui.QSpacerItem(54, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.TopicButtonLayout.addItem(spacerItem1) + self.TopicButtonLayout.setObjectName(u'TopicButtonLayout') + TopicSpacerItem = QtGui.QSpacerItem(54, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.TopicButtonLayout.addItem(TopicSpacerItem) self.TopicAddButton = QtGui.QPushButton(self.TopicButtonWidget) icon6 = QtGui.QIcon() - icon6.addPixmap(QtGui.QPixmap(":/songs/topic_add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon6.addPixmap(QtGui.QPixmap(u':/songs/topic_add.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.TopicAddButton.setIcon(icon6) - self.TopicAddButton.setObjectName("TopicAddButton") + self.TopicAddButton.setObjectName(u'TopicAddButton') self.TopicButtonLayout.addWidget(self.TopicAddButton) self.TopicEditButton = QtGui.QPushButton(self.TopicButtonWidget) icon7 = QtGui.QIcon() - icon7.addPixmap(QtGui.QPixmap(":/songs/topic_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon7.addPixmap(QtGui.QPixmap(u':/songs/topic_edit.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.TopicEditButton.setIcon(icon7) - self.TopicEditButton.setObjectName("TopicEditButton") + self.TopicEditButton.setObjectName(u'TopicEditButton') self.TopicButtonLayout.addWidget(self.TopicEditButton) self.TopicDeleteButton = QtGui.QPushButton(self.TopicButtonWidget) icon8 = QtGui.QIcon() - icon8.addPixmap(QtGui.QPixmap(":/songs/topic_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon8.addPixmap(QtGui.QPixmap(u':/songs/topic_delete.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.TopicDeleteButton.setIcon(icon8) - self.TopicDeleteButton.setObjectName("TopicDeleteButton") + self.TopicDeleteButton.setObjectName(u'TopicDeleteButton') self.TopicButtonLayout.addWidget(self.TopicDeleteButton) self.TopicLayout.addWidget(self.TopicButtonWidget) self.TopicsLine = QtGui.QFrame(self.TopicsPage) self.TopicsLine.setFrameShape(QtGui.QFrame.HLine) self.TopicsLine.setFrameShadow(QtGui.QFrame.Sunken) - self.TopicsLine.setObjectName("TopicsLine") + self.TopicsLine.setObjectName(u'TopicsLine') self.TopicLayout.addWidget(self.TopicsLine) self.TypeStackedWidget.addWidget(self.TopicsPage) self.BooksPage = QtGui.QWidget() - self.BooksPage.setObjectName("BooksPage") + self.BooksPage.setObjectName(u'BooksPage') self.BookLayout = QtGui.QVBoxLayout(self.BooksPage) self.BookLayout.setSpacing(4) self.BookLayout.setMargin(0) - self.BookLayout.setObjectName("BookLayout") + self.BookLayout.setObjectName(u'BookLayout') self.BooksListWidget = QtGui.QListWidget(self.BooksPage) - self.BooksListWidget.setObjectName("BooksListWidget") + self.BooksListWidget.setObjectName(u'BooksListWidget') self.BookLayout.addWidget(self.BooksListWidget) self.BookButtonWidget = QtGui.QWidget(self.BooksPage) - self.BookButtonWidget.setObjectName("BookButtonWidget") + self.BookButtonWidget.setObjectName(u'BookButtonWidget') self.BookButtonLayout = QtGui.QHBoxLayout(self.BookButtonWidget) self.BookButtonLayout.setSpacing(8) self.BookButtonLayout.setMargin(0) - self.BookButtonLayout.setObjectName("BookButtonLayout") - spacerItem2 = QtGui.QSpacerItem(54, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.BookButtonLayout.setObjectName(u'BookButtonLayout') + spacerItem2 = QtGui.QSpacerItem(54, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.BookButtonLayout.addItem(spacerItem2) self.BookAddButton = QtGui.QPushButton(self.BookButtonWidget) icon9 = QtGui.QIcon() - icon9.addPixmap(QtGui.QPixmap(":/songs/book_add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon9.addPixmap(QtGui.QPixmap(u':/songs/book_add.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.BookAddButton.setIcon(icon9) - self.BookAddButton.setObjectName("BookAddButton") + self.BookAddButton.setObjectName(u'BookAddButton') self.BookButtonLayout.addWidget(self.BookAddButton) self.BookEditButton = QtGui.QPushButton(self.BookButtonWidget) icon10 = QtGui.QIcon() - icon10.addPixmap(QtGui.QPixmap(":/songs/book_edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon10.addPixmap(QtGui.QPixmap(u':/songs/book_edit.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.BookEditButton.setIcon(icon10) - self.BookEditButton.setObjectName("BookEditButton") + self.BookEditButton.setObjectName(u'BookEditButton') self.BookButtonLayout.addWidget(self.BookEditButton) self.BookDeleteButton = QtGui.QPushButton(self.BookButtonWidget) icon11 = QtGui.QIcon() - icon11.addPixmap(QtGui.QPixmap(":/songs/book_delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon11.addPixmap(QtGui.QPixmap(u':/songs/book_delete.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.BookDeleteButton.setIcon(icon11) - self.BookDeleteButton.setObjectName("BookDeleteButton") + self.BookDeleteButton.setObjectName(u'BookDeleteButton') self.BookButtonLayout.addWidget(self.BookDeleteButton) self.BookLayout.addWidget(self.BookButtonWidget) self.BooksLine = QtGui.QFrame(self.BooksPage) self.BooksLine.setFrameShape(QtGui.QFrame.HLine) self.BooksLine.setFrameShadow(QtGui.QFrame.Sunken) - self.BooksLine.setObjectName("BooksLine") + self.BooksLine.setObjectName(u'BooksLine') self.BookLayout.addWidget(self.BooksLine) self.TypeStackedWidget.addWidget(self.BooksPage) self.ContentLayout.addWidget(self.TypeStackedWidget) @@ -196,30 +212,43 @@ class Ui_SongMaintenanceDialog(object): self.MaintenanceButtonBox = QtGui.QDialogButtonBox(SongMaintenanceDialog) self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal) self.MaintenanceButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) - self.MaintenanceButtonBox.setObjectName("MaintenanceButtonBox") + self.MaintenanceButtonBox.setObjectName(u'MaintenanceButtonBox') self.DialogLayout.addWidget(self.MaintenanceButtonBox) self.retranslateUi(SongMaintenanceDialog) - self.TypeStackedWidget.setCurrentIndex(2) - QtCore.QObject.connect(self.MaintenanceButtonBox, QtCore.SIGNAL("rejected()"), SongMaintenanceDialog.accept) - QtCore.QObject.connect(self.TypeListWidget, QtCore.SIGNAL("currentRowChanged(int)"), self.TypeStackedWidget.setCurrentIndex) + self.TypeStackedWidget.setCurrentIndex(0) + QtCore.QObject.connect(self.MaintenanceButtonBox, + QtCore.SIGNAL(u'rejected()'), SongMaintenanceDialog.accept) + QtCore.QObject.connect(self.TypeListWidget, + QtCore.SIGNAL(u'currentRowChanged(int)'), + self.TypeStackedWidget.setCurrentIndex) QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) def retranslateUi(self, SongMaintenanceDialog): - SongMaintenanceDialog.setWindowTitle(QtGui.QApplication.translate("SongMaintenanceDialog", "Song Maintenance", None, QtGui.QApplication.UnicodeUTF8)) - __sortingEnabled = self.TypeListWidget.isSortingEnabled() - self.TypeListWidget.setSortingEnabled(False) - self.TypeListWidget.item(0).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Authors", None, QtGui.QApplication.UnicodeUTF8)) - self.TypeListWidget.item(1).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Topics", None, QtGui.QApplication.UnicodeUTF8)) - self.TypeListWidget.item(2).setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Books/Hymnals", None, QtGui.QApplication.UnicodeUTF8)) - self.TypeListWidget.setSortingEnabled(__sortingEnabled) - self.AuthorAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) - self.AuthorEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) - self.AuthorDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) - self.TopicAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) - self.TopicEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) - self.TopicDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) - self.BookAddButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Add", None, QtGui.QApplication.UnicodeUTF8)) - self.BookEditButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8)) - self.BookDeleteButton.setText(QtGui.QApplication.translate("SongMaintenanceDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8)) + SongMaintenanceDialog.setWindowTitle( + translate(u'SongMaintenanceDialog', u'Song Maintenance')) + self.TypeListWidget.item(0).setText( + translate(u'SongMaintenanceDialog', u'Authors')) + self.TypeListWidget.item(1).setText( + translate(u'SongMaintenanceDialog', u'Topics')) + self.TypeListWidget.item(2).setText( + translate(u'SongMaintenanceDialog', u'Books/Hymnals')) + self.AuthorAddButton.setText( + translate(u'SongMaintenanceDialog', u'Add')) + self.AuthorEditButton.setText( + translate(u'SongMaintenanceDialog', u'Edit')) + self.AuthorDeleteButton.setText( + translate(u'SongMaintenanceDialog', u'Delete')) + self.TopicAddButton.setText( + translate(u'SongMaintenanceDialog', u'Add')) + self.TopicEditButton.setText( + translate(u'SongMaintenanceDialog', u'Edit')) + self.TopicDeleteButton.setText( + translate(u'SongMaintenanceDialog', u'Delete')) + self.BookAddButton.setText( + translate(u'SongMaintenanceDialog', u'Add')) + self.BookEditButton.setText( + translate(u'SongMaintenanceDialog', u'Edit')) + self.BookDeleteButton.setText( + translate(u'SongMaintenanceDialog', u'Delete')) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 8730ad1ac..edf9af332 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -59,14 +59,15 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick) def exec_(self): + self.TypeListWidget.setCurrentRow(0) self.resetAuthors() self.resetTopics() self.resetBooks() + self.TypeListWidget.setFocus() return QtGui.QDialog.exec_(self) def _getCurrentItemId(self, ListWidget): item = ListWidget.currentItem() - print item if item is not None: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] return item_id diff --git a/openlp/plugins/songs/forms/topicsdialog.py b/openlp/plugins/songs/forms/topicsdialog.py index 589fb8ccc..b97e5c10f 100644 --- a/openlp/plugins/songs/forms/topicsdialog.py +++ b/openlp/plugins/songs/forms/topicsdialog.py @@ -22,32 +22,40 @@ from openlp.core.lib import translate class Ui_TopicsDialog(object): def setupUi(self, TopicsDialog): - TopicsDialog.setObjectName("TopicsDialog") + TopicsDialog.setObjectName(u'TopicsDialog') TopicsDialog.resize(365, 77) self.TopicLayout = QtGui.QFormLayout(TopicsDialog) - self.TopicLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) + self.TopicLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.ExpandingFieldsGrow) self.TopicLayout.setMargin(8) self.TopicLayout.setSpacing(8) - self.TopicLayout.setObjectName("TopicLayout") + self.TopicLayout.setObjectName(u'TopicLayout') self.NameLabel = QtGui.QLabel(TopicsDialog) - self.NameLabel.setObjectName("NameLabel") - self.TopicLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.NameLabel) + self.NameLabel.setObjectName(u'NameLabel') + self.TopicLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.NameLabel) self.NameEdit = QtGui.QLineEdit(TopicsDialog) - self.NameEdit.setObjectName("NameEdit") - self.TopicLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.NameEdit) + self.NameEdit.setObjectName(u'NameEdit') + self.TopicLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.NameEdit) self.TopicButtonBox = QtGui.QDialogButtonBox(TopicsDialog) self.TopicButtonBox.setOrientation(QtCore.Qt.Horizontal) self.TopicButtonBox.setStandardButtons( QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) - self.TopicButtonBox.setObjectName("TopicButtonBox") - self.TopicLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.TopicButtonBox) + self.TopicButtonBox.setObjectName(u'TopicButtonBox') + self.TopicLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.TopicButtonBox) self.retranslateUi(TopicsDialog) - QtCore.QObject.connect(self.TopicButtonBox, QtCore.SIGNAL("accepted()"), TopicsDialog.accept) - QtCore.QObject.connect(self.TopicButtonBox, QtCore.SIGNAL("rejected()"), TopicsDialog.reject) + QtCore.QObject.connect(self.TopicButtonBox, + QtCore.SIGNAL(u'accepted()'), TopicsDialog.accept) + QtCore.QObject.connect(self.TopicButtonBox, + QtCore.SIGNAL(u'rejected()'), TopicsDialog.reject) QtCore.QMetaObject.connectSlotsByName(TopicsDialog) def retranslateUi(self, TopicsDialog): - TopicsDialog.setWindowTitle(QtGui.QApplication.translate("TopicsDialog", "Topic Maintenance", None, QtGui.QApplication.UnicodeUTF8)) - self.NameLabel.setText(QtGui.QApplication.translate("TopicsDialog", "Topic Name:", None, QtGui.QApplication.UnicodeUTF8)) + TopicsDialog.setWindowTitle( + translate(u'TopicsDialog', u'Topic Maintenance')) + self.NameLabel.setText( + translate(u'TopicsDialog', u'Topic name:')) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 826bbb786..a0539fe9a 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -60,9 +60,6 @@ class SongMediaItem(MediaManagerItem): self.ConfigSection = u'song' MediaManagerItem.__init__(self, parent, icon, title) self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager) - #self.authors_form = AuthorsForm(self.parent.songmanager) - #self.topics_form = TopicsForm(self.parent.songmanager) - #self.song_book_form = SongBookForm(self.parent.songmanager) self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self) def setupUi(self): @@ -96,22 +93,10 @@ class SongMediaItem(MediaManagerItem): translate(u'SongMediaItem', u'Add the selected song(s) to the service'), ':/system/system_add.png', self.onSongAddClick, 'SongAddItem') self.addToolbarSeparator() - ## Author Edit Button ## - #self.addToolbarButton(translate(u'SongMediaItem', u'Edit Authors'), - # translate(u'SongMediaItem', u'Maintain the list of Song Authors'), - # ':/songs/song_author_edit.png', self.onEditAuthorClick, 'SongAuthorEditItem') - ## Author Edit Button ## - #self.addToolbarButton(translate(u'SongMediaItem', u'Edit Books'), - # translate(u'SongMediaItem', u'Maintain the list of Song Books'), - # ':/songs/song_book_edit.png', self.onEditBookClick, 'SongAuthorEditItem') - # ## Author Edit Button ## - #self.addToolbarButton(translate(u'SongMediaItem', u'Edit Topics'), - # translate(u'SongMediaItem', u'Maintain the list of Song Topics'), - # ':/songs/song_topic_edit.png', self.onEditTopicClick, 'SongAuthorEditItem') ## Song Maintenance Button ## self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'), translate(u'SongMediaItem', u'Maintain the lists of authors, topics and books'), - ':/songs/song_author_edit.png', self.onSongMaintenanceClick, 'SongMaintenanceItem') + ':/songs/song_maintenance.png', self.onSongMaintenanceClick, 'SongMaintenanceItem') ## Add the songlist widget ## # Create the tab widget self.SongWidget = QtGui.QWidget(self) diff --git a/resources/forms/songmaintenance.ui b/resources/forms/songmaintenance.ui index dd06797fb..878fd7849 100644 --- a/resources/forms/songmaintenance.ui +++ b/resources/forms/songmaintenance.ui @@ -85,18 +85,6 @@ false - - false - - - true - - - false - - - false - New Row diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 98480206a..83c88c3e5 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -4,6 +4,7 @@ author_add.png author_delete.png book_add.png + song_maintenance.png topic_add.png book_delete.png book_edit.png diff --git a/resources/images/song_maintenance.png b/resources/images/song_maintenance.png new file mode 100644 index 0000000000000000000000000000000000000000..860e1717ec850bd2bc30b6c5bb6ec87f9b5d345a GIT binary patch literal 719 zcmV;=0xPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L02{9W02{9XUK)`c00007bV*G`2iXAx z12+)F5m%`I00K`*L_t(I%Z-y=NYil?hF{&|RL=t83LqW@e^iG)j5Z=LXoiOfP&gTd+3sR|e+B_;LlcV4hK+u`x~F){H8fHU!f?k)YR3&>+|F2VF}i#H87YAghD_5)?d72SX^A} z+XOc?H|DtAqc43vFL64ZB$-SQ*RX4~`fT-gRaK>p$K%}wpaQ_!1nc!3!jTczq}gmD zy;aH$_*LK_!wXQ^=rFRnfgYPrJs)KMZWxma>4wW(N_=5*|Mx2ZzHZ4*Ov5(9oOv z0Fs&f3UhAmXEQ)|N2AgFuV22suvr}s0jwg!`~yP%?dYO5V50y4002ovPDHLkV1fx6 BJ+c4* literal 0 HcmV?d00001 From 7eac26d98aa26769563f9ee7b0e05e9ad66da6fe Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 26 Jul 2009 00:07:59 +0200 Subject: [PATCH 5/7] Added validation to the Author dialog. --- openlp/plugins/songs/forms/authorsform.py | 105 ++++------------------ 1 file changed, 15 insertions(+), 90 deletions(-) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 94acb27ec..927fe0d7e 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -66,94 +66,19 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): def setAutoDisplayName(self, on): self.autoDisplayName = on + def accept(self): + if self.FirstNameEdit.text() == u'': + QtGui.QMessageBox.critical(self, + translate(u'AuthorsDialog', u'Error'), + translate(u'AuthorsDialog', u'You need to type in the first name of the author.'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + self.FirstNameEdit.setFocus() + return False + if self.LastNameEdit.text() == u'': + QtGui.QMessageBox.critical(self, + translate(u'AuthorsDialog', u'Error'), + translate(u'AuthorsDialog', u'You need to type in the last name of the author.'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + self.LastNameEdit.setFocus() + return False -# def load_form(self): -# """ -# Refresh the screen and rest fields -# """ -# self.AuthorListWidget.clear() -# # tidy up screen -# self.onClearButtonClick() -# authors = self.songmanager.get_authors() -# for author in authors: -# author_name = QtGui.QListWidgetItem(author.display_name) -# author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) -# self.AuthorListWidget.addItem(author_name) -# if self.currentRow >= self.AuthorListWidget.count() : -# self.AuthorListWidget.setCurrentRow(self.AuthorListWidget.count() - 1) -# else: -# self.AuthorListWidget.setCurrentRow(self.currentRow) -# self._validate_form() -# -# def onDeleteButtonClick(self): -# """ -# Delete the author is the Author is not attached to any songs -# """ -# self.songmanager.delete_author(self.author.id) -# self.load_form() -# -# def onDisplayEditLostFocus(self): -# self._validate_form() -# -# def onAddUpdateButtonClick(self): -# """ -# Sent New or update details to the database -# """ -# if self.author == None: -# self.author = Author() -# self.author.display_name = unicode(self.DisplayEdit.displayText()) -# self.author.first_name = unicode(self.FirstNameEdit.displayText()) -# self.author.last_name = unicode(self.LastNameEdit.displayText()) -# self.songmanager.save_author(self.author) -# self.onClearButtonClick() -# self.load_form() -# -# def onClearButtonClick(self): -# """ -# Tidy up screen if clear button pressed -# """ -# self.DisplayEdit.setText(u'') -# self.FirstNameEdit.setText(u'') -# self.LastNameEdit.setText(u'') -# self.MessageLabel.setText(u'') -# self.DeleteButton.setEnabled(False) -# self.author = None -# self._validate_form() -# self.DisplayEdit.setFocus() -# -# def onAuthorListWidgetItemClicked(self, index): -# """ -# An Author has been selected display it -# If the author is attached to a Song prevent delete -# """ -# self.currentRow = self.AuthorListWidget.currentRow() -# item = self.AuthorListWidget.currentItem() -# item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] -# self.author = self.songmanager.get_author(item_id) -# self.DisplayEdit.setText(self.author.display_name) -# if self.author.first_name is None: -# self.FirstNameEdit.setText(u'') -# else: -# self.FirstNameEdit.setText(self.author.first_name) -# if self.author.last_name is None: -# self.LastNameEdit.setText(u'') -# else: -# self.LastNameEdit.setText(self.author.last_name) -# if len(self.author.songs) > 0: -# self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled')) -# self.DeleteButton.setEnabled(False) -# else: -# self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used')) -# self.DeleteButton.setEnabled(True) -# self._validate_form() -# self.DisplayEdit.setFocus() -# -# def _validate_form(self): -# """ -# Validate the form and set if Add button if valid. -# """ -# # We need at lease a display name -# if len(self.DisplayEdit.displayText()) == 0: -# self.AddUpdateButton.setEnabled(False) -# else: -# self.AddUpdateButton.setEnabled(True) From 1915f93b6e97f17d39a9f114675fef23ec1e0f0a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 26 Jul 2009 10:36:57 +0200 Subject: [PATCH 6/7] Added the rest of the validation and tested that it all works. --- openlp/plugins/songs/forms/authorsform.py | 5 +++-- openlp/plugins/songs/forms/songbookform.py | 10 ++++++++++ openlp/plugins/songs/forms/topicsform.py | 10 ++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 927fe0d7e..7fc8f708f 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -74,11 +74,12 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.FirstNameEdit.setFocus() return False - if self.LastNameEdit.text() == u'': + elif self.LastNameEdit.text() == u'': QtGui.QMessageBox.critical(self, translate(u'AuthorsDialog', u'Error'), translate(u'AuthorsDialog', u'You need to type in the last name of the author.'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.LastNameEdit.setFocus() return False - + else: + return QtGui.QDialog.accept(self) diff --git a/openlp/plugins/songs/forms/songbookform.py b/openlp/plugins/songs/forms/songbookform.py index 879bfca3e..78e44cbad 100644 --- a/openlp/plugins/songs/forms/songbookform.py +++ b/openlp/plugins/songs/forms/songbookform.py @@ -39,3 +39,13 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog): self.NameEdit.setFocus() return QtGui.QDialog.exec_(self) + def accept(self): + if self.NameEdit.text() == u'': + QtGui.QMessageBox.critical(self, + translate(u'SongBookDialog', u'Error'), + translate(u'SongBookDialog', u'You need to type in a book name!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + self.NameEdit.setFocus() + return False + else: + return QtGui.QDialog.accept(self) diff --git a/openlp/plugins/songs/forms/topicsform.py b/openlp/plugins/songs/forms/topicsform.py index 810bf760f..d86c2f464 100644 --- a/openlp/plugins/songs/forms/topicsform.py +++ b/openlp/plugins/songs/forms/topicsform.py @@ -37,3 +37,13 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog): self.NameEdit.setFocus() return QtGui.QDialog.exec_(self) + def accept(self): + if self.NameEdit.text() == u'': + QtGui.QMessageBox.critical(self, + translate(u'SongBookDialog', u'Error'), + translate(u'SongBookDialog', u'You need to type in a topic name!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + self.NameEdit.setFocus() + return False + else: + return QtGui.QDialog.accept(self) From 67f4669df26ebe14baced4a57d804809082c3ddd Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 26 Jul 2009 12:02:18 +0200 Subject: [PATCH 7/7] Updated author validation to validate the display name as well. --- openlp/plugins/songs/forms/authorsform.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 7fc8f708f..7b5cddd3f 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -81,5 +81,18 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.LastNameEdit.setFocus() return False + elif self.DisplayEdit.text() == u'': + if QtGui.QMessageBox.critical(self, + translate(u'AuthorsDialog', u'Error'), + translate(u'AuthorsDialog', u'You haven\'t set a display name for the author, would you like me to combine the first and last names for you?'), + QtGui.QMessageBox.StandardButtons( + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) + ) == QtGui.QMessageBox.Yes: + self.DisplayEdit.setText(self.FirstNameEdit.text() + \ + u' ' + self.LastNameEdit.text()) + return QtGui.QDialog.accept(self) + else: + self.DisplayEdit.setFocus() + return False else: return QtGui.QDialog.accept(self)