Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
pitivi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Millan Castro
pitivi
Commits
771f6d45
Commit
771f6d45
authored
Mar 13, 2014
by
Alexandru Băluț
Committed by
Mathieu Duponchelle
Mar 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the soft dependencies objects from the check module
parent
8f5d7a3c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
39 deletions
+98
-39
pitivi/check.py
pitivi/check.py
+16
-8
pitivi/medialibrary.py
pitivi/medialibrary.py
+11
-11
pitivi/render.py
pitivi/render.py
+16
-12
pitivi/utils/system.py
pitivi/utils/system.py
+5
-8
tests/Makefile.am
tests/Makefile.am
+1
-0
tests/test_check.py
tests/test_check.py
+49
-0
No files found.
pitivi/check.py
View file @
771f6d45
...
...
@@ -88,6 +88,9 @@ class Dependency(object):
"""
raise
NotImplementedError
def
__nonzero__
(
self
):
return
self
.
satisfied
def
__repr__
(
self
):
if
self
.
satisfied
:
return
""
...
...
@@ -177,14 +180,19 @@ HARD_DEPENDENCIES = (CairoDependency("1.10.0"),
GIDependency
(
"Gio"
,
None
),
GstPluginDependency
(
"gnonlin"
,
"1.1.90"
))
SOFT_DEPENDENCIES
=
(
ClassicDependency
(
"pycanberra"
,
None
,
_
(
"enables sound notifications when rendering is complete"
)),
GIDependency
(
"GnomeDesktop"
,
None
,
_
(
"file thumbnails provided by GNOME's thumbnailers"
)),
GIDependency
(
"Notify"
,
None
,
_
(
"enables visual notifications when rendering is complete"
)),
GstPluginDependency
(
"libav"
,
None
,
_
(
"additional multimedia codecs through the Libav library"
)))
PYCANBERRA_SOFT_DEPENDENCY
=
ClassicDependency
(
"pycanberra"
,
None
,
_
(
"enables sound notifications when rendering is complete"
))
GNOMEDESKTOP_SOFT_DEPENDENCY
=
GIDependency
(
"GnomeDesktop"
,
None
,
_
(
"file thumbnails provided by GNOME's thumbnailers"
))
NOTIFY_SOFT_DEPENDENCY
=
GIDependency
(
"Notify"
,
None
,
_
(
"enables visual notifications when rendering is complete"
))
LIBAV_SOFT_DEPENDENCY
=
GstPluginDependency
(
"libav"
,
None
,
_
(
"additional multimedia codecs through the Libav library"
))
SOFT_DEPENDENCIES
=
(
PYCANBERRA_SOFT_DEPENDENCY
,
GNOMEDESKTOP_SOFT_DEPENDENCY
,
NOTIFY_SOFT_DEPENDENCY
,
LIBAV_SOFT_DEPENDENCY
)
def
_check_audiosinks
():
...
...
pitivi/medialibrary.py
View file @
771f6d45
...
...
@@ -26,11 +26,6 @@ from gi.repository import Gst
from
gi.repository
import
GES
from
gi.repository
import
Gio
from
gi.repository
import
GLib
try
:
from
gi.repository
import
GnomeDesktop
has_gnome_desktop
=
True
except
ImportError
:
has_gnome_desktop
=
False
from
gi.repository
import
GObject
from
gi.repository
import
Gtk
from
gi.repository
import
Gdk
...
...
@@ -47,6 +42,7 @@ from urlparse import urlparse
from
hashlib
import
md5
from
gi.repository.GstPbutils
import
DiscovererVideoInfo
from
pitivi.check
import
GNOMEDESKTOP_SOFT_DEPENDENCY
from
pitivi.configure
import
get_ui_dir
,
get_pixmap_dir
from
pitivi.settings
import
GlobalSettings
from
pitivi.mediafilespreviewer
import
PreviewWidget
...
...
@@ -300,12 +296,16 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
self
.
pack_start
(
self
.
treeview_scrollwin
,
True
,
True
,
0
)
self
.
pack_start
(
self
.
_progressbar
,
False
,
True
,
0
)
if
has_gnome_desktop
:
# We need to instanciate the thumbnail factory on the main thread...
size_normal
=
GnomeDesktop
.
DesktopThumbnailSize
.
NORMAL
self
.
thumbnailer
=
GnomeDesktop
.
DesktopThumbnailFactory
.
new
(
size_normal
)
else
:
self
.
thumbnailer
=
None
self
.
thumbnailer
=
MediaLibraryWidget
.
_getThumbnailer
()
@
staticmethod
def
_getThumbnailer
():
if
not
GNOMEDESKTOP_SOFT_DEPENDENCY
:
return
None
from
gi.repository
import
GnomeDesktop
# We need to instanciate the thumbnail factory on the main thread...
size_normal
=
GnomeDesktop
.
DesktopThumbnailSize
.
NORMAL
return
GnomeDesktop
.
DesktopThumbnailFactory
.
new
(
size_normal
)
@
staticmethod
def
compare_basename
(
model
,
iter1
,
iter2
,
unused_user_data
):
...
...
pitivi/render.py
View file @
771f6d45
...
...
@@ -25,27 +25,25 @@ Rendering-related utilities and classes
"""
import
os
import
time
from
gi.repository
import
GLib
from
gi.repository
import
Gtk
from
gi.repository
import
Gst
from
gi.repository
import
GES
import
time
from
gettext
import
gettext
as
_
from
pitivi
import
configure
from
pitivi.utils.signal
import
Signallable
from
pitivi.check
import
PYCANBERRA_SOFT_DEPENDENCY
from
pitivi.utils.loggable
import
Loggable
from
pitivi.utils.widgets
import
GstElementSettingsDialog
from
pitivi.utils.ripple_update_group
import
RippleUpdateGroup
from
pitivi.utils.misc
import
show_user_manual
,
path_from_uri
from
pitivi.utils.ripple_update_group
import
RippleUpdateGroup
from
pitivi.utils.signal
import
Signallable
from
pitivi.utils.ui
import
model
,
frame_rates
,
audio_rates
,
\
audio_channels
,
get_combo_value
,
set_combo_value
,
beautify_ETA
try
:
import
pycanberra
has_canberra
=
True
except
ImportError
:
has_canberra
=
False
from
pitivi.utils.widgets
import
GstElementSettingsDialog
class
CachedEncoderList
(
object
):
...
...
@@ -865,6 +863,14 @@ class RenderDialog(Loggable):
def
destroy
(
self
):
self
.
window
.
destroy
()
@
staticmethod
def
_maybePlayFinishedSound
():
if
not
PYCANBERRA_SOFT_DEPENDENCY
:
return
import
pycanberra
canberra
=
pycanberra
.
Canberra
()
canberra
.
play
(
1
,
pycanberra
.
CA_PROP_EVENT_ID
,
"complete-media"
,
None
)
#------------------- Callbacks ------------------------------------------#
#-- UI callbacks
...
...
@@ -966,9 +972,7 @@ class RenderDialog(Loggable):
if
not
self
.
progress
.
window
.
is_active
():
notification
=
_
(
'"%s" has finished rendering.'
%
self
.
fileentry
.
get_text
())
self
.
notification
=
self
.
app
.
system
.
desktopMessage
(
_
(
"Render complete"
),
notification
,
"pitivi"
)
if
has_canberra
:
canberra
=
pycanberra
.
Canberra
()
canberra
.
play
(
1
,
pycanberra
.
CA_PROP_EVENT_ID
,
"complete-media"
,
None
)
self
.
_maybePlayFinishedSound
()
self
.
progress
.
play_rendered_file_button
.
show
()
self
.
progress
.
close_button
.
show
()
self
.
progress
.
cancel_button
.
hide
()
...
...
pitivi/utils/system.py
View file @
771f6d45
...
...
@@ -23,16 +23,11 @@ import multiprocessing
import
os
import
resource
from
pitivi.check
import
NOTIFY_SOFT_DEPENDENCY
from
pitivi.configure
import
APPNAME
from
pitivi.utils.loggable
import
Loggable
from
pitivi.utils.signal
import
Signallable
try
:
from
gi.repository
import
Notify
has_libnotify
=
True
except
ImportError
:
has_libnotify
=
False
class
System
(
Signallable
,
Loggable
):
"""A base class for all *Systems
...
...
@@ -173,14 +168,16 @@ class FreedesktopOrgSystem(System):
def
__init__
(
self
):
System
.
__init__
(
self
)
if
has_libnotify
:
if
NOTIFY_SOFT_DEPENDENCY
:
from
gi.repository
import
Notify
Notify
.
init
(
APPNAME
)
def
desktopMessage
(
self
,
title
,
message
,
icon
=
"pitivi"
):
#call super method for consistent logging
System
.
desktopMessage
(
self
,
title
,
message
,
icon
)
if
has_libnotify
:
if
NOTIFY_SOFT_DEPENDENCY
:
from
gi.repository
import
Notify
notification
=
Notify
.
Notification
.
new
(
title
,
message
,
icon
=
icon
)
try
:
notification
.
show
()
...
...
tests/Makefile.am
View file @
771f6d45
...
...
@@ -4,6 +4,7 @@
# Keep this list sorted!
tests
=
\
test_application.py
\
test_check.py
\
test_common.py
\
test_log.py
\
test_mainwindow.py
\
...
...
tests/test_check.py
0 → 100644
View file @
771f6d45
# -*- coding: utf-8 -*-
# Pitivi video editor
#
# tests/test_check.py
#
# Copyright (c) 2014, Alex Băluț <alexandru.balut@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
from
common
import
TestCase
from
pitivi
import
check
class
FakeDependency
(
check
.
Dependency
):
import_result
=
None
def
_try_importing_component
(
self
):
return
self
.
import_result
class
TestDependency
(
TestCase
):
def
testBoolEvaluation
(
self
):
dependency
=
FakeDependency
(
modulename
=
"module1"
,
version_required_string
=
None
)
self
.
assertFalse
(
dependency
)
self
.
assertFalse
(
dependency
.
satisfied
)
dependency
.
check
()
self
.
assertFalse
(
dependency
)
self
.
assertFalse
(
dependency
.
satisfied
)
dependency
.
import_result
=
"something"
dependency
.
check
()
self
.
assertTrue
(
dependency
)
self
.
assertTrue
(
dependency
.
satisfied
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment