# HG changeset patch # User Aziz K?ksal # Date 1195337772 -3600 # Node ID 1401e38d1e2e93c2498ffed5dc4e438d21a8d8a8 # Parent 04adc4e3fddaa064d8cddb28e78207076b25d5f6 Translator: implemented project properties dialog. Added language file properties dialog. diff -r 04adc4e3fdda -r 1401e38d1e2e trunk/AUTHORS --- a/trunk/AUTHORS Wed Nov 14 22:07:50 2007 +0100 +++ b/trunk/AUTHORS Sat Nov 17 23:16:12 2007 +0100 @@ -2,8 +2,8 @@ Aziz Köksal "All rights to the code I've written will pass over to Jari-Matti Mäkelä, in case I catch the bus or the bus catches me. - My death won't probably be announced anywhere on - the internet, therefore my testament will become effective if I don't + My death will probably not be made known anywhere on the internet, + therefore my testament will become effective if I don't show any signs of life for 6 months on the internet. Within this time limit I may always revoke or edit this testament, by committing to the hg repository at http://hg.sharesource.org/dil/ diff -r 04adc4e3fdda -r 1401e38d1e2e trunk/src/translator/langfile_properties.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/translator/langfile_properties.ui Sat Nov 17 23:16:12 2007 +0100 @@ -0,0 +1,128 @@ + + LangFilePropertiesDialog + + + + 0 + 0 + 400 + 228 + + + + Language File Properties + + + + + + + + Language code: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + langCodeField + + + + + + + + + + Creation date: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + creationDateField + + + + + + + + + + + + + Author(s): + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + LangFilePropertiesDialog + accept() + + + 227 + 278 + + + 157 + 274 + + + + + buttonBox + rejected() + LangFilePropertiesDialog + reject() + + + 295 + 284 + + + 286 + 274 + + + + + diff -r 04adc4e3fdda -r 1401e38d1e2e trunk/src/translator/project.py --- a/trunk/src/translator/project.py Wed Nov 14 22:07:50 2007 +0100 +++ b/trunk/src/translator/project.py Sat Nov 17 23:16:12 2007 +0100 @@ -94,8 +94,16 @@ def setName(self, name): self.name = name + def setBuildScript(self, filePath): + self.buildScript = filePath + + def setCreationDate(self, date): + self.creationDate = date + def save(self): self.doc["Name"] = self.name + self.doc["BuildScript"] = self.buildScript + self.doc["CreationDate"] = self.creationDate file_ = open(self.projectPath, "w") yaml.dump(self.doc, stream=file_, allow_unicode=True) file_.close() diff -r 04adc4e3fdda -r 1401e38d1e2e trunk/src/translator/project_properties.ui --- a/trunk/src/translator/project_properties.ui Wed Nov 14 22:07:50 2007 +0100 +++ b/trunk/src/translator/project_properties.ui Sat Nov 17 23:16:12 2007 +0100 @@ -1,12 +1,12 @@ - ProjectProperties - + ProjectPropertiesDialog + 0 0 400 - 148 + 152 @@ -34,18 +34,42 @@ - Build command: + Build script: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - buildCommandField + buildScriptField - + + + + + + + + ... + + + + + + + + + + + + Creation date: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + @@ -79,7 +103,7 @@ buttonBox accepted() - ProjectProperties + ProjectPropertiesDialog accept() @@ -95,7 +119,7 @@ buttonBox rejected() - ProjectProperties + ProjectPropertiesDialog reject() diff -r 04adc4e3fdda -r 1401e38d1e2e trunk/src/translator/translator.py --- a/trunk/src/translator/translator.py Wed Nov 14 22:07:50 2007 +0100 +++ b/trunk/src/translator/translator.py Sat Nov 17 23:16:12 2007 +0100 @@ -10,7 +10,7 @@ from ui_translator import Ui_MainWindow from ui_about import Ui_AboutDialog from ui_new_project import Ui_NewProjectDialog -from ui_project_properties import Ui_ProjectProperties +from ui_project_properties import Ui_ProjectPropertiesDialog from ui_msg_form import Ui_MsgForm from ui_closing_project import Ui_ClosingProjectDialog @@ -94,9 +94,9 @@ about.exec_() def showProjectProperties(self): - dialog = QtGui.QDialog() - Ui_ProjectProperties().setupUi(dialog) + dialog = ProjectPropertiesDialog(self.project) dialog.exec_() + self.projectTree.updateProjectName() def createNewProject(self): if self.rejectClosingProject(): @@ -133,6 +133,8 @@ def addCatalogue(self): filePath = QtGui.QFileDialog.getOpenFileName(self, "Select Project File", g_CWD, "Catalogue (*%s)" % g_catExt); filePath = str(filePath) + # TODO: + #self.project.addLangFile(filePath) def addNewCatalogue(self): pass @@ -499,8 +501,11 @@ self.topItem = None self.msgIDsItem = None self.headerItem().setHidden(True) + self.ignoreItemChanged = False def itemChanged(self, item, column): + if self.ignoreItemChanged: + return text = unicode(item.text(0)) #if hasattr(item, "textChanged"): #item.textChanged(text) @@ -554,6 +559,11 @@ def showMenuMsgIDItem(self, item): print "MsgIDItem" + def updateProjectName(self): + self.ignoreItemChanged = True + self.topItem.setText(0, self.project.name) + self.ignoreItemChanged = False + def clear(self): self.project = None self.topItem = None @@ -589,21 +599,42 @@ self.done(self.DiscardAll) +class ProjectPropertiesDialog(QtGui.QDialog, Ui_ProjectPropertiesDialog): + def __init__(self, project): + QtGui.QDialog.__init__(self) + self.setupUi(self) + Qt.connect(self.pickFileButton, Qt.SIGNAL("clicked()"), self.pickFilePath) + + self.project = project + self.projectNameField.setText(self.project.name) + self.buildScriptField.setText(self.project.buildScript) + self.creationDateField.setText(self.project.creationDate) + + def pickFilePath(self): + filePath = QtGui.QFileDialog.getOpenFileName(self, "Select Build Script File", g_CWD, "Python Script (*.py)"); + if filePath: + self.buildScriptField.setText(str(filePath)) + + def accept(self): + self.project.setName(unicode(self.projectNameField.text())) + self.project.setBuildScript(unicode(self.buildScriptField.text())) + self.project.setCreationDate(str(self.creationDateField.text())) + QtGui.QDialog.accept(self) + + class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog): def __init__(self): QtGui.QDialog.__init__(self) self.setupUi(self) - Qt.connect(self.pickFileButton, Qt.SIGNAL("clicked()"), self.pickFilePath) def pickFilePath(self): filePath = QtGui.QFileDialog.getSaveFileName(self, "New Project File", g_CWD, "Translator Project (*%s)" % g_projectExt); - if not filePath: - return - filePath = str(filePath) # Convert QString - if os.path.splitext(filePath)[1] != g_projectExt: - filePath += g_projectExt - self.projectFilePath.setText(filePath) + if filePath: + filePath = str(filePath) # Convert QString + if os.path.splitext(filePath)[1] != g_projectExt: + filePath += g_projectExt + self.projectFilePath.setText(filePath) def accept(self): projectName = str(self.projectName.text()) diff -r 04adc4e3fdda -r 1401e38d1e2e trunk/src/translator/ui_langfile_properties.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/translator/ui_langfile_properties.py Sat Nov 17 23:16:12 2007 +0100 @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'langfile_properties.ui' +# +# Created: Sat Nov 17 23:14:57 2007 +# by: PyQt4 UI code generator 4.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_LangFilePropertiesDialog(object): + def setupUi(self, LangFilePropertiesDialog): + LangFilePropertiesDialog.setObjectName("LangFilePropertiesDialog") + LangFilePropertiesDialog.resize(QtCore.QSize(QtCore.QRect(0,0,400,228).size()).expandedTo(LangFilePropertiesDialog.minimumSizeHint())) + + self.vboxlayout = QtGui.QVBoxLayout(LangFilePropertiesDialog) + self.vboxlayout.setObjectName("vboxlayout") + + self.gridlayout = QtGui.QGridLayout() + self.gridlayout.setObjectName("gridlayout") + + self.label_2 = QtGui.QLabel(LangFilePropertiesDialog) + self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_2.setObjectName("label_2") + self.gridlayout.addWidget(self.label_2,1,0,1,1) + + self.langCodeField = QtGui.QLineEdit(LangFilePropertiesDialog) + self.langCodeField.setObjectName("langCodeField") + self.gridlayout.addWidget(self.langCodeField,1,1,1,1) + + self.label = QtGui.QLabel(LangFilePropertiesDialog) + self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label.setObjectName("label") + self.gridlayout.addWidget(self.label,2,0,1,1) + + self.creationDateField = QtGui.QLineEdit(LangFilePropertiesDialog) + self.creationDateField.setObjectName("creationDateField") + self.gridlayout.addWidget(self.creationDateField,2,1,1,1) + + self.authorsField = QtGui.QTextEdit(LangFilePropertiesDialog) + self.authorsField.setObjectName("authorsField") + self.gridlayout.addWidget(self.authorsField,0,1,1,1) + + self.label_3 = QtGui.QLabel(LangFilePropertiesDialog) + self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTop|QtCore.Qt.AlignTrailing) + self.label_3.setObjectName("label_3") + self.gridlayout.addWidget(self.label_3,0,0,1,1) + self.vboxlayout.addLayout(self.gridlayout) + + spacerItem = QtGui.QSpacerItem(20,10,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Fixed) + self.vboxlayout.addItem(spacerItem) + + self.buttonBox = QtGui.QDialogButtonBox(LangFilePropertiesDialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.vboxlayout.addWidget(self.buttonBox) + self.label_2.setBuddy(self.langCodeField) + self.label.setBuddy(self.creationDateField) + + self.retranslateUi(LangFilePropertiesDialog) + QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),LangFilePropertiesDialog.accept) + QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),LangFilePropertiesDialog.reject) + QtCore.QMetaObject.connectSlotsByName(LangFilePropertiesDialog) + + def retranslateUi(self, LangFilePropertiesDialog): + LangFilePropertiesDialog.setWindowTitle(QtGui.QApplication.translate("LangFilePropertiesDialog", "Language File Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("LangFilePropertiesDialog", "Language code:", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("LangFilePropertiesDialog", "Creation date:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("LangFilePropertiesDialog", "Author(s):", None, QtGui.QApplication.UnicodeUTF8)) + diff -r 04adc4e3fdda -r 1401e38d1e2e trunk/src/translator/ui_project_properties.py --- a/trunk/src/translator/ui_project_properties.py Wed Nov 14 22:07:50 2007 +0100 +++ b/trunk/src/translator/ui_project_properties.py Sat Nov 17 23:16:12 2007 +0100 @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'project_properties.ui' # -# Created: Sun Oct 21 17:33:29 2007 +# Created: Sat Nov 17 23:14:55 2007 # by: PyQt4 UI code generator 4.1 # # WARNING! All changes made in this file will be lost! @@ -10,54 +10,73 @@ import sys from PyQt4 import QtCore, QtGui -class Ui_ProjectProperties(object): - def setupUi(self, ProjectProperties): - ProjectProperties.setObjectName("ProjectProperties") - ProjectProperties.resize(QtCore.QSize(QtCore.QRect(0,0,400,148).size()).expandedTo(ProjectProperties.minimumSizeHint())) +class Ui_ProjectPropertiesDialog(object): + def setupUi(self, ProjectPropertiesDialog): + ProjectPropertiesDialog.setObjectName("ProjectPropertiesDialog") + ProjectPropertiesDialog.resize(QtCore.QSize(QtCore.QRect(0,0,400,152).size()).expandedTo(ProjectPropertiesDialog.minimumSizeHint())) - self.vboxlayout = QtGui.QVBoxLayout(ProjectProperties) + self.vboxlayout = QtGui.QVBoxLayout(ProjectPropertiesDialog) self.vboxlayout.setObjectName("vboxlayout") self.gridlayout = QtGui.QGridLayout() self.gridlayout.setObjectName("gridlayout") - self.label_2 = QtGui.QLabel(ProjectProperties) + self.label_2 = QtGui.QLabel(ProjectPropertiesDialog) self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_2.setObjectName("label_2") self.gridlayout.addWidget(self.label_2,0,0,1,1) - self.projectNameField = QtGui.QLineEdit(ProjectProperties) + self.projectNameField = QtGui.QLineEdit(ProjectPropertiesDialog) self.projectNameField.setObjectName("projectNameField") self.gridlayout.addWidget(self.projectNameField,0,1,1,1) - self.label = QtGui.QLabel(ProjectProperties) + self.label = QtGui.QLabel(ProjectPropertiesDialog) self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label.setObjectName("label") self.gridlayout.addWidget(self.label,1,0,1,1) - self.buildCommandField = QtGui.QLineEdit(ProjectProperties) - self.buildCommandField.setObjectName("buildCommandField") - self.gridlayout.addWidget(self.buildCommandField,1,1,1,1) + self.hboxlayout = QtGui.QHBoxLayout() + self.hboxlayout.setObjectName("hboxlayout") + + self.buildScriptField = QtGui.QLineEdit(ProjectPropertiesDialog) + self.buildScriptField.setObjectName("buildScriptField") + self.hboxlayout.addWidget(self.buildScriptField) + + self.pickFileButton = QtGui.QToolButton(ProjectPropertiesDialog) + self.pickFileButton.setObjectName("pickFileButton") + self.hboxlayout.addWidget(self.pickFileButton) + self.gridlayout.addLayout(self.hboxlayout,1,1,1,1) + + self.creationDateField = QtGui.QLineEdit(ProjectPropertiesDialog) + self.creationDateField.setObjectName("creationDateField") + self.gridlayout.addWidget(self.creationDateField,2,1,1,1) + + self.label_3 = QtGui.QLabel(ProjectPropertiesDialog) + self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_3.setObjectName("label_3") + self.gridlayout.addWidget(self.label_3,2,0,1,1) self.vboxlayout.addLayout(self.gridlayout) spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.vboxlayout.addItem(spacerItem) - self.buttonBox = QtGui.QDialogButtonBox(ProjectProperties) + self.buttonBox = QtGui.QDialogButtonBox(ProjectPropertiesDialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.vboxlayout.addWidget(self.buttonBox) self.label_2.setBuddy(self.projectNameField) - self.label.setBuddy(self.buildCommandField) + self.label.setBuddy(self.buildScriptField) + + self.retranslateUi(ProjectPropertiesDialog) + QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),ProjectPropertiesDialog.accept) + QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),ProjectPropertiesDialog.reject) + QtCore.QMetaObject.connectSlotsByName(ProjectPropertiesDialog) - self.retranslateUi(ProjectProperties) - QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),ProjectProperties.accept) - QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),ProjectProperties.reject) - QtCore.QMetaObject.connectSlotsByName(ProjectProperties) + def retranslateUi(self, ProjectPropertiesDialog): + ProjectPropertiesDialog.setWindowTitle(QtGui.QApplication.translate("ProjectPropertiesDialog", "Project Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("ProjectPropertiesDialog", "Project name:", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("ProjectPropertiesDialog", "Build script:", None, QtGui.QApplication.UnicodeUTF8)) + self.pickFileButton.setText(QtGui.QApplication.translate("ProjectPropertiesDialog", "...", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("ProjectPropertiesDialog", "Creation date:", None, QtGui.QApplication.UnicodeUTF8)) - def retranslateUi(self, ProjectProperties): - ProjectProperties.setWindowTitle(QtGui.QApplication.translate("ProjectProperties", "Project Properties", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setText(QtGui.QApplication.translate("ProjectProperties", "Project name:", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("ProjectProperties", "Build command:", None, QtGui.QApplication.UnicodeUTF8)) -