summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciana Fujii Pontello <luciana@fujii.eti.br>2010-08-11 23:04:57 (GMT)
committerLuciana Fujii Pontello <luciana@fujii.eti.br>2010-08-12 20:30:58 (GMT)
commit491ab5a00b5b74872029c375490f17cdedcfcc59 (patch)
tree8c58cc97ab13b42186944ae98da3f1975d4141b6
parent4558bf63a7f70fe51a37e386730fe2a1295a9aee (diff)
downloadsltv-491ab5a00b5b74872029c375490f17cdedcfcc59.tar.gz
sltv-491ab5a00b5b74872029c375490f17cdedcfcc59.tar.xz
OutputsView: stopping the output in sltv
Creating signals to treat when the stop button in the UI is clicked, which asks sltv to stop the output. We also separated classes OutputsView and OutputItem in different files.
-rw-r--r--sltv/ui/Makefile.am3
-rw-r--r--sltv/ui/output_item.py50
-rw-r--r--sltv/ui/outputs_view.py22
3 files changed, 58 insertions, 17 deletions
diff --git a/sltv/ui/Makefile.am b/sltv/ui/Makefile.am
index 571f839..e97418d 100644
--- a/sltv/ui/Makefile.am
+++ b/sltv/ui/Makefile.am
@@ -28,6 +28,7 @@ sltvlib_DATA = \
pip_widget.py \
metadata.py \
watermark.py \
- videobalance.py
+ videobalance.py \
+ output_item.py
EXTRA_DIST = $(sltvlib_DATA)
diff --git a/sltv/ui/output_item.py b/sltv/ui/output_item.py
new file mode 100644
index 0000000..6a5f2ee
--- /dev/null
+++ b/sltv/ui/output_item.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2010 Holoscópio Tecnologia
+# Author: Marcelo Jorge Vieira <metal@holoscopio.com>
+# Author: Luciana Fujii Pontello <luciana@holoscopio.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import gtk
+import gobject
+from sltv.settings import UI_DIR
+
+class OutputItem(gobject.GObject):
+ __gsignals__ = {
+ 'stopped' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ())
+ }
+
+
+ def __init__(self, name):
+ gobject.GObject.__init__(self)
+ self.name = name
+
+ self.interface = gtk.Builder()
+ self.interface.add_from_file(UI_DIR + "/output.ui")
+
+ self.widget = self.interface.get_object("output_box")
+ self.button = self.interface.get_object("output_button")
+ self.label = self.interface.get_object("output_label")
+ self.label.set_text(self.name)
+
+ self.button.connect("clicked", self._on_stop_clicked)
+
+ def _on_stop_clicked(self, button):
+ self.emit("stopped")
+
+ def get_widget(self):
+ return self.widget
+
+gobject.type_register(OutputItem)
diff --git a/sltv/ui/outputs_view.py b/sltv/ui/outputs_view.py
index a9437b3..e8f3393 100644
--- a/sltv/ui/outputs_view.py
+++ b/sltv/ui/outputs_view.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Holoscópio Tecnologia
# Author: Marcelo Jorge Vieira <metal@holoscopio.com>
+# Author: Luciana Fujii Pontello <luciana@holoscopio.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +18,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import gtk
-from sltv.settings import UI_DIR
+from output_item import OutputItem
class OutputsView(gtk.VBox):
@@ -42,6 +43,7 @@ class OutputsView(gtk.VBox):
def _create_item(self, name):
output_item = OutputItem(name)
self.output_items[name] = output_item
+ self.output_items[name].connect("stopped", self._on_output_stopped)
def _add_output(self, medialist, name, item):
self._create_item(name)
@@ -50,6 +52,7 @@ class OutputsView(gtk.VBox):
def _remove_output(self, medialist, name, item):
self.foreach(self._remove_output_item)
+ self.output_items[name].disconnect_by_func(self._on_output_stopped)
self.output_items.pop(name)
self._add_items()
@@ -60,18 +63,5 @@ class OutputsView(gtk.VBox):
def _remove_output_item(self, widget):
self.remove(widget)
-
-class OutputItem:
-
- def __init__(self, name):
- self.name = name
-
- self.interface = gtk.Builder()
- self.interface.add_from_file(UI_DIR + "/output.ui")
-
- self.widget = self.interface.get_object("output_box")
- self.label = self.interface.get_object("output_label")
- self.label.set_text(self.name)
-
- def get_widget(self):
- return self.widget
+ def _on_output_stopped(self, output_item):
+ self.sltv.stop_output(output_item.name)