Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dcpman
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
dcp
dcpman
Commits
fd22da96
Commit
fd22da96
authored
10 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
Now logs exception as well.
parent
9fb79942
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/manager.py
+31
-31
31 additions, 31 deletions
source/manager.py
with
31 additions
and
31 deletions
source/manager.py
+
31
−
31
View file @
fd22da96
...
...
@@ -14,27 +14,27 @@ from os.path import basename
import
syslog
import
time
class
verifyThread
(
QtCore
.
QThread
):
class
verifyThread
(
QtCore
.
QThread
):
'''
A seperate thread to verify the DCP (IO intensive).
Verify the assets of DCP (reads all of the files to
calculate the hash) in a seperate thread from the GUI to keep the GUI
responsive. At the end update the verifyLine test to reflect the result.
'''
def
run
(
self
):
def
run
(
self
):
'''
The action the thread takes.
'''
result
=
dcp
.
verify
()
result
=
dcp
.
verify
()
try
:
result
=
dcp
.
verify
()
result
=
dcp
.
verify
()
if
result
:
window
.
verifyLine
.
setText
(
'
OK
'
)
window
.
verifyLine
.
setText
(
'
OK
'
)
syslog
.
syslog
(
syslog
.
LOG_INFO
,
time
.
ctime
()
+
\
directoryname
+
'
verification succeeded.
'
)
else
:
window
.
verifyLine
.
setText
(
'
Corrupted!
'
)
window
.
verifyLine
.
setText
(
'
Corrupted!
'
)
syslog
.
syslog
(
syslog
.
LOG_INFO
,
time
.
ctime
()
+
\
directoryname
+
'
verification failed.
'
)
except
BaseException
as
exception
:
window
.
verifyLine
.
setText
(
str
(
exception
))
window
.
verifyLine
.
setText
(
str
(
exception
))
def
verify_in_thread
():
...
...
@@ -43,33 +43,33 @@ def verify_in_thread():
Firstly disable the button and change the verifyLine to reflect that the
verification is running (in the same thread to update the window immediately
then calls the seperate thread to verify the assets of DCP.
'''
window
.
verifyLine
.
setText
(
'
Verifying, please wait...
'
)
window
.
verifyButton
.
setEnabled
(
False
)
thread
.
start
()
window
.
verifyLine
.
setText
(
'
Verifying, please wait...
'
)
window
.
verifyButton
.
setEnabled
(
False
)
thread
.
start
()
if
__name__
==
'
__main__
'
:
syslog
.
openlog
(
ident
=
'
dcpman
'
,
facility
=
syslog
.
LOG_USER
)
app
=
QtGui
.
QApplication
(
sys
.
argv
)
icon
=
QtGui
.
QIcon
(
'
/usr/share/icons/oxygen/16x16/apps/kmplayer.png
'
)
app
.
setWindowIcon
(
icon
)
directory
=
QtGui
.
QFileDialog
.
getExistingDirectory
(
\
app
=
QtGui
.
QApplication
(
sys
.
argv
)
icon
=
QtGui
.
QIcon
(
'
/usr/share/icons/oxygen/16x16/apps/kmplayer.png
'
)
app
.
setWindowIcon
(
icon
)
directory
=
QtGui
.
QFileDialog
.
getExistingDirectory
(
\
caption
=
'
Please select the location of the DCP
'
)
directoryname
=
basename
(
directory
)
mainwindow
=
QtGui
.
QMainWindow
()
window
=
ui
.
Ui_MainWindow
()
window
.
setupUi
(
mainwindow
)
thread
=
verifyThread
()
mainwindow
=
QtGui
.
QMainWindow
()
window
=
ui
.
Ui_MainWindow
()
window
.
setupUi
(
mainwindow
)
thread
=
verifyThread
()
try
:
dcp
=
DCP
(
directory
)
dcp
=
DCP
(
directory
)
try
:
window
.
nameLine
.
setText
(
dcp
.
name
)
window
.
nameLine
.
setText
(
dcp
.
name
)
syslog
.
syslog
(
syslog
.
LOG_INFO
,
time
.
ctime
()
+
directoryname
+
\
'
parsed.
'
)
except
AttributeError
:
except
AttributeError
as
exception
:
window
.
nameLine
.
setText
(
basename
(
directory
))
syslog
.
syslog
(
syslog
.
LOG_INFO
,
time
.
ctime
()
+
directoryname
+
\
'
parsed.
'
)
exception
)
if
dcp
.
signed
:
syslog
.
syslog
(
syslog
.
LOG_INFO
,
time
.
ctime
()
+
directoryname
+
\
'
is signed.
'
)
...
...
@@ -79,16 +79,16 @@ if __name__ == '__main__':
syslog
.
syslog
(
syslog
.
LOG_INFO
,
time
.
ctime
()
+
directoryname
+
\
'
duration is
'
+
str
(
dcp
.
duration
))
if
dcp
.
signed
and
dcp
.
duration
==
0
:
window
.
encryptedLine
.
setText
(
'
Most likely
'
)
window
.
encryptedLine
.
setText
(
'
Most likely
'
)
elif
dcp
.
signed
or
dcp
.
duration
==
0
:
window
.
encryptedLine
.
setText
(
'
Probably
'
)
else
:
window
.
encryptedLine
.
setText
(
'
Probably not
'
)
window
.
verifyLine
.
setText
(
'
Click button to start verification
'
)
window
.
verifyButton
.
clicked
.
connect
(
verify_in_thread
)
window
.
encryptedLine
.
setText
(
'
Probably not
'
)
window
.
verifyLine
.
setText
(
'
Click button to start verification
'
)
window
.
verifyButton
.
clicked
.
connect
(
verify_in_thread
)
except
BaseException
as
exception
:
window
.
nameLine
.
setText
(
str
(
exception
))
window
.
verifyButton
.
setEnabled
(
False
)
mainwindow
.
show
()
mainwindow
.
activateWindow
()
exit
(
app
.
exec_
())
window
.
nameLine
.
setText
(
str
(
exception
))
window
.
verifyButton
.
setEnabled
(
False
)
mainwindow
.
show
()
mainwindow
.
activateWindow
()
exit
(
app
.
exec_
())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment