forked from openlp/openlp
Merge branch 'master' into test_fixes
This commit is contained in:
commit
1a582f2345
@ -1,6 +1,20 @@
|
||||
stages:
|
||||
- lint
|
||||
- test
|
||||
|
||||
lint:
|
||||
stage: lint
|
||||
image: python
|
||||
before_script:
|
||||
- apt-get update
|
||||
# packages required for dbus-python
|
||||
- apt-get -y install libdbus-1-dev libdbus-glib-1-dev
|
||||
# packages required for pyodbc
|
||||
- apt-get -y install unixodbc unixodbc-dev
|
||||
- pip install -e .[test]
|
||||
script:
|
||||
- flake8
|
||||
|
||||
test-debian:
|
||||
stage: test
|
||||
variables:
|
||||
|
@ -9,14 +9,14 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
|
||||
class Ui_AuditDetailDialog(object):
|
||||
def setupUi(self, AuditDetailDialog):
|
||||
AuditDetailDialog.setObjectName(u'AuditDetailDialog')
|
||||
AuditDetailDialog.resize(593, 501)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(AuditDetailDialog)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(420, 470, 170, 25))
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.FileGroupBox = QtGui.QGroupBox(AuditDetailDialog)
|
||||
self.FileGroupBox.setGeometry(QtCore.QRect(10, 370, 571, 70))
|
||||
@ -31,7 +31,7 @@ class Ui_AuditDetailDialog(object):
|
||||
self.SaveFilePushButton = QtGui.QPushButton(self.FileGroupBox)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.SaveFilePushButton.setIcon(icon)
|
||||
self.SaveFilePushButton.setObjectName(u'SaveFilePushButton')
|
||||
self.horizontalLayout.addWidget(self.SaveFilePushButton)
|
||||
|
@ -26,6 +26,7 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from auditdetaildialog import Ui_AuditDetailDialog
|
||||
|
||||
|
||||
class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
@ -68,10 +69,8 @@ class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog):
|
||||
self.resetWindow()
|
||||
|
||||
def defineOutputLocation(self):
|
||||
path = QtGui.QFileDialog.getExistingDirectory(self,
|
||||
self.trUtf8(u'Output File Location'),
|
||||
self.parent.config.get_last_dir(1) )
|
||||
path = unicode(path)
|
||||
path = QtGui.QFileDialog.getExistingDirectory(self, self.trUtf8(u'Output File Location'),
|
||||
self.parent.config.get_last_dir(1))
|
||||
if path != u'':
|
||||
self.parent.config.set_last_dir(path, 1)
|
||||
self.FileLineEdit.setText(path)
|
||||
@ -97,10 +96,10 @@ class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog):
|
||||
self.ThirdToTimeEdit.setEnabled(True)
|
||||
|
||||
def accept(self):
|
||||
print self.DetailedReport.isChecked()
|
||||
print self.SummaryReport.isChecked()
|
||||
print self.FromDateEdit.date()
|
||||
print self.ToDateEdit.date()
|
||||
print(self.DetailedReport.isChecked())
|
||||
print(self.SummaryReport.isChecked())
|
||||
print(self.FromDateEdit.date())
|
||||
print(self.ToDateEdit.date())
|
||||
if self.DetailedReport.isChecked():
|
||||
self.detailedReport()
|
||||
else:
|
||||
@ -108,15 +107,15 @@ class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog):
|
||||
self.close()
|
||||
|
||||
def detailedReport(self):
|
||||
print "detailed"
|
||||
print("detailed")
|
||||
filename = u'audit_det_%s_%s.txt' % \
|
||||
(self.FromDateEdit.date().toString(u'ddMMyyyy'),
|
||||
self.ToDateEdit.date().toString(u'ddMMyyyy'))
|
||||
print filename
|
||||
print(filename)
|
||||
|
||||
def summaryReport(self):
|
||||
print "summary"
|
||||
print("summary")
|
||||
filename = u'audit_sum_%s_%s.txt' % \
|
||||
(self.FromDateEdit.date().toString(u'ddMMyyyy'),
|
||||
self.ToDateEdit.date().toString(u'ddMMyyyy'))
|
||||
print filename
|
||||
print(filename)
|
||||
|
@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
import os
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from launchpadlib.credentials import UnencryptedFileCredentialStore
|
||||
from launchpadlib.launchpad import Launchpad
|
||||
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def parse_args():
|
||||
"""
|
||||
Parse the command line arguments
|
||||
"""
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('-p', '--merge-proposal', required=True,
|
||||
help='The main part of the URL to the merge proposal, without the hostname.')
|
||||
parser.add_argument('-m', '--message', required=True,
|
||||
help='The comment to add to the merge proposal')
|
||||
parser.add_argument('-s', '--subject', default=None, help='The subject for the comment')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def get_merge_proposal(merge_proposal_url):
|
||||
"""
|
||||
Get the merge proposal for the ``merge_proposal_url``
|
||||
"""
|
||||
lp = Launchpad.login_with('OpenLP CI', 'production', version='devel',
|
||||
credential_store=UnencryptedFileCredentialStore(os.path.join(HERE, 'launchpadcreds.txt')))
|
||||
openlp_project = lp.projects['openlp']
|
||||
merge_proposals = openlp_project.getMergeProposals()
|
||||
for merge_proposal in merge_proposals:
|
||||
if str(merge_proposal).endswith(merge_proposal_url):
|
||||
return merge_proposal
|
||||
return None
|
||||
|
||||
|
||||
def create_comment(merge_proposal, comment, subject):
|
||||
"""
|
||||
Create a comment on the merge proposal
|
||||
"""
|
||||
if not subject:
|
||||
subject = 'Jenkins test update'
|
||||
merge_proposal.createComment(subject=subject, content=comment)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Run the thing
|
||||
"""
|
||||
args = parse_args()
|
||||
merge_proposal = get_merge_proposal(args.merge_proposal)
|
||||
if not merge_proposal:
|
||||
print('No merge proposal with that URL found')
|
||||
sys.exit(1)
|
||||
else:
|
||||
create_comment(merge_proposal, args.message, args.subject)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
18
setup.py
18
setup.py
@ -197,16 +197,16 @@ using a computer and a data projector.""",
|
||||
'sword-bibles': ['pysword'],
|
||||
# Required for scripts/*.py:
|
||||
'jenkins': ['python-jenkins'],
|
||||
'launchpad': ['launchpadlib']
|
||||
'launchpad': ['launchpadlib'],
|
||||
'test': [
|
||||
'PyMuPDF',
|
||||
'pyodbc',
|
||||
'pysword',
|
||||
'pytest',
|
||||
'python-xlib; platform_system=="Linux"',
|
||||
'flake8',
|
||||
]
|
||||
},
|
||||
tests_require=[
|
||||
'pylint',
|
||||
'PyMuPDF',
|
||||
'pyodbc',
|
||||
'pysword',
|
||||
'pytest',
|
||||
'python-xlib; platform_system=="Linux"'
|
||||
],
|
||||
setup_requires=['pytest-runner'],
|
||||
entry_points={'gui_scripts': ['openlp = openlp.__main__:start']}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user