def init(self): self.setAcceptsHoverEvents(True) self.layout = QGraphicsLinearLayout(Qt.Vertical, self) self.layout.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.scroller = LockableScrollWidget(self) self.scroller.setMinimumSize(120, 90) self.layout.addItem(self.scroller) if self.applet.formFactor() != Plasma.Planar: self.scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.source_panel = QGraphicsWidget() self.sink_panel = QGraphicsWidget() self.scrolled_panel_layout = QGraphicsLinearLayout(Qt.Vertical) self.scrolled_panel_widget = QGraphicsWidget() self.scrolled_panel_widget.setLayout(self.scrolled_panel_layout) self.scrolled_panel_layout.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.scrolled_panel_layout.setContentsMargins(0, 0, 0, 6) self.showsTabs = not self.applet.useTabs() self.switchView(True) self.source_panel_layout = SortedLayout(Qt.Vertical, False) self.source_panel_layout.setSpacing(0) self.source_panel.setLayout(self.source_panel_layout) self.source_panel_layout.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) if self.showsTabs: self.source_panel_layout.addStretch() self.sink_panel_layout = SortedLayout(Qt.Vertical, False) self.sink_panel_layout.setSpacing(0) self.sink_panel.setLayout(self.sink_panel_layout) self.sink_panel_layout.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.layout.setContentsMargins(0, 0, 0, 0) self.source_panel_layout.setContentsMargins(0, 0, 0, 0) self.sink_panel_layout.setContentsMargins(0, 0, 0, 0) #QTimer.singleShot(4000, self.start_pa) self.start_pa() self.connect_mediaplayers()
def init(self): self.setAcceptsHoverEvents (True) self.layout = QGraphicsLinearLayout(Qt.Vertical, self) self.layout.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.scroller = LockableScrollWidget(self) self.scroller.setMinimumSize(120,90) self.layout.addItem(self.scroller) if self.applet.formFactor() != Plasma.Planar : self.scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.source_panel = QGraphicsWidget() self.sink_panel = QGraphicsWidget() self.scrolled_panel_layout = QGraphicsLinearLayout(Qt.Vertical) self.scrolled_panel_widget = QGraphicsWidget() self.scrolled_panel_widget.setLayout(self.scrolled_panel_layout) self.scrolled_panel_layout.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.scrolled_panel_layout.setContentsMargins(0,0,0,6) self.showsTabs = not self.applet.useTabs() self.switchView(True) self.source_panel_layout = SortedLayout(Qt.Vertical, False) self.source_panel_layout.setSpacing(0) self.source_panel.setLayout(self.source_panel_layout) self.source_panel_layout.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) if self.showsTabs: self.source_panel_layout.addStretch() self.sink_panel_layout = SortedLayout(Qt.Vertical, False) self.sink_panel_layout.setSpacing(0) self.sink_panel.setLayout(self.sink_panel_layout) self.sink_panel_layout.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.layout.setContentsMargins(0,0,0,0) self.source_panel_layout.setContentsMargins(0,0,0,0) self.sink_panel_layout.setContentsMargins(0,0,0,0) #QTimer.singleShot(4000, self.start_pa) self.start_pa() self.connect_mediaplayers()
class VeroMix(QGraphicsWidget): sinkOutputChanged = pyqtSignal() def __init__(self,parent): QGraphicsWidget.__init__(self) self.applet = parent self.pa = None self.last_resize_running = datetime.datetime.now() self.last_resize_running_timer_running = False self.card_infos = {} self.ladspa_index = 1 self.setFocusPolicy(Qt.TabFocus) def init(self): self.setAcceptsHoverEvents (True) self.layout = QGraphicsLinearLayout(Qt.Vertical, self) self.layout.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.scroller = LockableScrollWidget(self) self.scroller.setMinimumSize(120,90) self.layout.addItem(self.scroller) if self.applet.formFactor() != Plasma.Planar : self.scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.source_panel = QGraphicsWidget() self.sink_panel = QGraphicsWidget() self.scrolled_panel_layout = QGraphicsLinearLayout(Qt.Vertical) self.scrolled_panel_widget = QGraphicsWidget() self.scrolled_panel_widget.setLayout(self.scrolled_panel_layout) self.scrolled_panel_layout.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.scrolled_panel_layout.setContentsMargins(0,0,0,6) self.showsTabs = not self.applet.useTabs() self.switchView(True) self.source_panel_layout = SortedLayout(Qt.Vertical, False) self.source_panel_layout.setSpacing(0) self.source_panel.setLayout(self.source_panel_layout) self.source_panel_layout.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) if self.showsTabs: self.source_panel_layout.addStretch() self.sink_panel_layout = SortedLayout(Qt.Vertical, False) self.sink_panel_layout.setSpacing(0) self.sink_panel.setLayout(self.sink_panel_layout) self.sink_panel_layout.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.layout.setContentsMargins(0,0,0,0) self.source_panel_layout.setContentsMargins(0,0,0,0) self.sink_panel_layout.setContentsMargins(0,0,0,0) #QTimer.singleShot(4000, self.start_pa) self.start_pa() self.connect_mediaplayers() def switchView(self, startup=False): if self.showsTabs: self.scrolled_panel_layout = QGraphicsLinearLayout(Qt.Vertical) scrolled_panel = QGraphicsWidget() scrolled_panel.setLayout(self.scrolled_panel_layout) self.scrolled_panel_layout.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.scrolled_panel_layout.addItem(self.source_panel) self.scrolled_panel_layout.addItem(self.sink_panel) else: scrolled_panel = Plasma.TabBar() scrolled_panel.addTab(i18n("Playback"), self.sink_panel) scrolled_panel.addTab(i18n("Record"), self.source_panel) self.source_panel.show() self.scrolled_panel = scrolled_panel self.showsTabs = not self.showsTabs self.scroller.setWidget(self.scrolled_panel) if not startup: self.check_geometries() def on_update_configuration(self): for source in self.source_panel_layout.getChannels().values(): source.on_update_configuration() for sink in self.sink_panel_layout.getChannels().values(): sink.on_update_configuration() self.pa.set_autostart_meters(bool(self.applet.is_meter_visible())) # connect to pulseaudio(dbus) callbacks def start_pa(self): try: self.pa = PulseAudio(self) self.pa.connect_veromix_service() except Exception, e: self.showMessage(KIcon("script-error"), i18n("There is a problem with the backgroud-service. \ <ul> \ <li>If you just upgraded try killing the process named: VeromixServiceMain.py and relaunch this plasmoid</li> \ <li>If you don't know how to do that consider rebooting</li></ul><br/>\ <a href=\"http://code.google.com/p/veromix-plasmoid/wiki/Debugging\">See wiki for more details</a> <span style=\"font-size: small;\">(right click and copy url)</span>.")) print "\nError connecting to veromix-service:\n" , e, "\n" return self.connect(self.pa, SIGNAL("on_sink_input_info(PyQt_PyObject)"), self.on_sink_input_info) self.connect(self.pa, SIGNAL("on_sink_info(PyQt_PyObject)"), self.on_sink_info) self.connect(self.pa, SIGNAL("on_source_output_info(PyQt_PyObject)"), self.on_source_output_info) self.connect(self.pa, SIGNAL("on_source_info(PyQt_PyObject)"), self.on_source_info) self.connect(self.pa, SIGNAL("on_sink_remove(int)"), self.on_remove_sink) self.connect(self.pa, SIGNAL("on_sink_input_remove(int)"), self.on_remove_sink_input) self.connect(self.pa, SIGNAL("on_source_remove(int)"), self.on_remove_source) self.connect(self.pa, SIGNAL("on_source_output_remove(int)"), self.on_remove_source_output) self.connect(self.pa, SIGNAL("on_volume_meter_sink(int, float)"), self.on_volume_meter_sink) self.connect(self.pa, SIGNAL("on_volume_meter_sink_input(int, float)"), self.on_volume_meter_sink_input) self.connect(self.pa, SIGNAL("on_volume_meter_source(int, float)"), self.on_volume_meter_source) self.connect(self.pa, SIGNAL("on_card_info(PyQt_PyObject)"), self.on_card_info) self.connect(self.pa, SIGNAL("on_card_remove(int)"), self.on_remove_card) self.connect(self.pa, SIGNAL("on_module_info(int,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.on_module_info) self.pa.requestInfo()
class VeroMix(QGraphicsWidget): sinkOutputChanged = pyqtSignal() def __init__(self, parent): QGraphicsWidget.__init__(self) self.applet = parent self.pa = None self.last_resize_running = datetime.datetime.now() self.last_resize_running_timer_running = False self.card_infos = {} self.ladspa_index = 1 self.setFocusPolicy(Qt.TabFocus) def init(self): self.setAcceptsHoverEvents(True) self.layout = QGraphicsLinearLayout(Qt.Vertical, self) self.layout.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.scroller = LockableScrollWidget(self) self.scroller.setMinimumSize(120, 90) self.layout.addItem(self.scroller) if self.applet.formFactor() != Plasma.Planar: self.scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.source_panel = QGraphicsWidget() self.sink_panel = QGraphicsWidget() self.scrolled_panel_layout = QGraphicsLinearLayout(Qt.Vertical) self.scrolled_panel_widget = QGraphicsWidget() self.scrolled_panel_widget.setLayout(self.scrolled_panel_layout) self.scrolled_panel_layout.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.scrolled_panel_layout.setContentsMargins(0, 0, 0, 6) self.showsTabs = not self.applet.useTabs() self.switchView(True) self.source_panel_layout = SortedLayout(Qt.Vertical, False) self.source_panel_layout.setSpacing(0) self.source_panel.setLayout(self.source_panel_layout) self.source_panel_layout.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) if self.showsTabs: self.source_panel_layout.addStretch() self.sink_panel_layout = SortedLayout(Qt.Vertical, False) self.sink_panel_layout.setSpacing(0) self.sink_panel.setLayout(self.sink_panel_layout) self.sink_panel_layout.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.layout.setContentsMargins(0, 0, 0, 0) self.source_panel_layout.setContentsMargins(0, 0, 0, 0) self.sink_panel_layout.setContentsMargins(0, 0, 0, 0) #QTimer.singleShot(4000, self.start_pa) self.start_pa() self.connect_mediaplayers() def switchView(self, startup=False): if self.showsTabs: self.scrolled_panel_layout = QGraphicsLinearLayout(Qt.Vertical) scrolled_panel = QGraphicsWidget() scrolled_panel.setLayout(self.scrolled_panel_layout) self.scrolled_panel_layout.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.scrolled_panel_layout.addItem(self.source_panel) self.scrolled_panel_layout.addItem(self.sink_panel) else: scrolled_panel = Plasma.TabBar() scrolled_panel.addTab(i18n("Playback"), self.sink_panel) scrolled_panel.addTab(i18n("Record"), self.source_panel) self.source_panel.show() self.scrolled_panel = scrolled_panel self.showsTabs = not self.showsTabs self.scroller.setWidget(self.scrolled_panel) if not startup: self.check_geometries() def on_update_configuration(self): for source in self.source_panel_layout.getChannels().values(): source.on_update_configuration() for sink in self.sink_panel_layout.getChannels().values(): sink.on_update_configuration() self.pa.set_autostart_meters(bool(self.applet.is_meter_visible())) # connect to pulseaudio(dbus) callbacks def start_pa(self): try: self.pa = PulseAudio(self) self.pa.connect_veromix_service() except Exception, e: self.showMessage( KIcon("script-error"), i18n("There is a problem with the backgroud-service. \ <ul> \ <li>If you just upgraded try killing the process named: VeromixServiceMain.py and relaunch this plasmoid</li> \ <li>If you don't know how to do that consider rebooting</li></ul><br/>\ <a href=\"http://code.google.com/p/veromix-plasmoid/wiki/Debugging\">See wiki for more details</a> <span style=\"font-size: small;\">(right click and copy url)</span>." )) print "\nError connecting to veromix-service:\n", e, "\n" return self.connect(self.pa, SIGNAL("on_sink_input_info(PyQt_PyObject)"), self.on_sink_input_info) self.connect(self.pa, SIGNAL("on_sink_info(PyQt_PyObject)"), self.on_sink_info) self.connect(self.pa, SIGNAL("on_source_output_info(PyQt_PyObject)"), self.on_source_output_info) self.connect(self.pa, SIGNAL("on_source_info(PyQt_PyObject)"), self.on_source_info) self.connect(self.pa, SIGNAL("on_sink_remove(int)"), self.on_remove_sink) self.connect(self.pa, SIGNAL("on_sink_input_remove(int)"), self.on_remove_sink_input) self.connect(self.pa, SIGNAL("on_source_remove(int)"), self.on_remove_source) self.connect(self.pa, SIGNAL("on_source_output_remove(int)"), self.on_remove_source_output) self.connect(self.pa, SIGNAL("on_volume_meter_sink(int, float)"), self.on_volume_meter_sink) self.connect(self.pa, SIGNAL("on_volume_meter_sink_input(int, float)"), self.on_volume_meter_sink_input) self.connect(self.pa, SIGNAL("on_volume_meter_source(int, float)"), self.on_volume_meter_source) self.connect(self.pa, SIGNAL("on_card_info(PyQt_PyObject)"), self.on_card_info) self.connect(self.pa, SIGNAL("on_card_remove(int)"), self.on_remove_card) self.connect( self.pa, SIGNAL( "on_module_info(int,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)" ), self.on_module_info) self.pa.requestInfo()