-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
84 lines (67 loc) · 3.01 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- coding: utf-8 -*-
# PEP8:OK, LINT:OK, PY3:OK
#############################################################################
## This file may be used under the terms of the GNU General Public
## License version 2.0 or 3.0 as published by the Free Software Foundation
## and appearing in the file LICENSE.GPL included in the packaging of
## this file. Please review the following information to ensure GNU
## General Public Licensing requirements will be met:
## http:#www.fsf.org/licensing/licenses/info/GPLv2.html and
## http:#www.gnu.org/copyleft/gpl.html.
##
## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#############################################################################
# metadata
" NINJA-IDE Multimedia "
__version__ = ' 0.2 '
__license__ = ' GPL '
__author__ = ' juancarlospaco '
__email__ = ' juancarlospaco@ubuntu.com '
__url__ = ''
__date__ = ' 30/05/2013 '
__prj__ = ' multimedia '
__docformat__ = 'html'
__source__ = ''
__full_licence__ = ''
# imports
from os import path
from PyQt4.QtGui import QIcon, QLabel, QDockWidget, QPushButton, QFileDialog
try:
from PyKDE4.kdecore import KPluginLoader, KUrl
from PyKDE4.kparts import *
except ImportError:
pass
from ninja_ide.core import plugin
###############################################################################
class Main(plugin.Plugin):
" dock Class "
def initialize(self):
" Init Class dock "
self.dock = QDockWidget()
self.dock.setFeatures(QDockWidget.DockWidgetFloatable |
QDockWidget.DockWidgetMovable)
self.dock.setWindowTitle(__doc__)
self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
self.boton = QPushButton(QIcon.fromTheme("media-eject"),
' Open Media ', self.dock)
try:
self.factory = KPluginLoader("dragonpart").factory()
self.part = self.factory.create(self)
self.boton.clicked.connect(lambda: self.part.openUrl(KUrl(str(
QFileDialog.getOpenFileName(self.dock, ' Open Media File ',
path.expanduser("~"), ';;'.join(['(*.{})'.format(e) for e in
['ogv', 'webm', 'avi', 'mpg', 'mpeg', '3gp', 'wmv', 'mp3',
'asf', 'dat', 'flv', 'flac', 'ogg', 'mkv', 'mov', 'swf', 'wav',
'rm', 'm4v', 'aaf', 'mp4', 'raw', '*']]))))))
self.dock.setWidget(self.part.widget())
except:
self.dock.setWidget(QLabel(""" <center> <h3>ಠ_ಠ<br>
ERROR: Please, install Dragon Player and PyKDE ! </h3><br>
<br><i> (Sorry, cant embed non-Qt Apps). </i>><center>"""))
self.misc = self.locator.get_service('misc')
self.misc.add_widget(self.dock,
QIcon.fromTheme("applications-multimedia"), __doc__)
###############################################################################
if __name__ == "__main__":
print(__doc__)