Пример #1
0
	def __init__(self):
		self.log = logging.getLogger('Voctogui')

		# Uf a UI-File was specified on the Command-Line, load it
		if Args.ui_file:
			self.log.info('loading ui-file from file specified on command-line: %s', self.options.ui_file)
			self.ui = Ui(Args.ui_file)

		else:
			# Paths to look for the gst-switch UI-File
			paths = [
				os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ui/voctogui.ui'),
				'/usr/lib/voctogui/ui/voctogui.ui'
			]

			# Look for a gst-switch UI-File and load it
			for path in paths:
				self.log.debug('trying to load ui-file from file %s', path)

				if os.path.isfile(path):
					self.log.info('loading ui-file from file %s', path)
					self.ui = Ui(path)
					break

		if self.ui is None:
			raise Exception("Can't find any .ui-Files to use (searched %s)" % (', '.join(paths)))

		self.ui.setup()
Пример #2
0
class Voctogui(object):
    def __init__(self):
        self.log = logging.getLogger('Voctogui')

        # Uf a UI-File was specified on the Command-Line, load it
        if Args.ui_file:
            self.log.info(
                'loading ui-file from file specified on command-line: %s',
                Args.ui_file)
            self.ui = Ui(Args.ui_file)
        else:
            # Paths to look for the gst-switch UI-File
            paths = [
                os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             'ui/voctogui.ui'),
                '/usr/lib/voctogui/ui/voctogui.ui'
            ]

            # Look for a gst-switch UI-File and load it
            self.ui = None
            for path in paths:
                self.log.debug('trying to load ui-file from file %s', path)

                if os.path.isfile(path):
                    self.log.info('loading ui-file from file %s', path)
                    self.ui = Ui(path)
                    break

        if self.ui is None:
            raise Exception("Can't find any .ui-Files to use "
                            "(searched {})".format(', '.join(paths)))

        self.ui.setup()

    def run(self):
        self.log.info('setting UI visible')
        self.ui.show()

        try:
            self.log.info('running Gtk-MainLoop')
            Gtk.main()
            self.log.info('Gtk-MainLoop ended')
        except KeyboardInterrupt:
            self.log.info('Terminated via Ctrl-C')

    def quit(self):
        self.log.info('quitting Gtk-MainLoop')
        Gtk.main_quit()
Пример #3
0
class Voctogui(object):
	def __init__(self):
		self.log = logging.getLogger('Voctogui')

		# Uf a UI-File was specified on the Command-Line, load it
		if Args.ui_file:
			self.log.info('loading ui-file from file specified on command-line: %s', self.options.ui_file)
			self.ui = Ui(Args.ui_file)

		else:
			# Paths to look for the gst-switch UI-File
			paths = [
				os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ui/voctogui.ui'),
				'/usr/lib/voctogui/ui/voctogui.ui'
			]

			# Look for a gst-switch UI-File and load it
			for path in paths:
				self.log.debug('trying to load ui-file from file %s', path)

				if os.path.isfile(path):
					self.log.info('loading ui-file from file %s', path)
					self.ui = Ui(path)
					break

		if self.ui is None:
			raise Exception("Can't find any .ui-Files to use (searched %s)" % (', '.join(paths)))

		self.ui.setup()


	def run(self):
		self.log.info('setting UI visible')
		self.ui.show()

		try:
			self.log.info('running Gtk-MainLoop')
			Gtk.main()
			self.log.info('Gtk-MainLoop ended')
		except KeyboardInterrupt:
			self.log.info('Terminated via Ctrl-C')

	def quit(self):
		self.log.info('quitting Gtk-MainLoop')
		Gtk.main_quit()
Пример #4
0
    def __init__(self):
        self.log = logging.getLogger('Voctogui')
        from lib.args import Args
        from lib.ui import Ui

        # Uf a UI-File was specified on the Command-Line, load it
        if Args.ui_file:
            self.log.info(
                'loading ui-file from file specified on command-line: %s',
                Args.ui_file)
            self.ui = Ui(Args.ui_file)
        else:
            # Paths to look for the gst-switch UI-File
            paths = [
                os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             'ui/voctogui.ui'),
                '/usr/lib/voctogui/ui/voctogui.ui'
            ]

            # Look for a gst-switch UI-File and load it
            self.ui = None
            for path in paths:
                self.log.debug('trying to load ui-file from file %s', path)

                if os.path.isfile(path):
                    self.log.info('loading ui-file from file %s', path)
                    self.ui = Ui(path)
                    break

        if self.ui is None:
            raise Exception("Can't find any .ui-Files to use "
                            "(searched {})".format(', '.join(paths)))

        #
        # search for a .css style sheet file and load it
        #

        css_provider = Gtk.CssProvider()
        context = Gtk.StyleContext()

        css_paths = [
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         'ui/voctogui.css'),
            '/usr/lib/voctogui/ui/voctogui.css'
        ]

        for path in css_paths:
            self.log.debug('trying to load css-file from file %s', path)

            if os.path.isfile(path):
                self.log.info('loading css-file from file %s', path)
                css_provider.load_from_path(path)
                break
        else:
            raise Exception("Can't find any .css-Files to use "
                            "(searched {})".format(', '.join(css_paths)))

        context.add_provider_for_screen(Gdk.Screen.get_default(), css_provider,
                                        Gtk.STYLE_PROVIDER_PRIORITY_USER)

        self.ui.setup()
Пример #5
0
    def __init__(self):
        self.log = logging.getLogger('Voctogui')
        from lib.args import Args
        from lib.ui import Ui

        # Uf a UI-File was specified on the Command-Line, load it
        if Args.ui_file:
            self.log.info(
                'loading ui-file from file specified on command-line: %s',
                Args.ui_file
            )
            self.ui = Ui(Args.ui_file)
        else:
            # Paths to look for the gst-switch UI-File
            paths = [
                os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             'ui/voctogui.ui'),
                '/usr/lib/voctogui/ui/voctogui.ui'
            ]

            # Look for a gst-switch UI-File and load it
            self.ui = None
            for path in paths:
                self.log.debug('trying to load ui-file from file %s', path)

                if os.path.isfile(path):
                    self.log.info('loading ui-file from file %s', path)
                    self.ui = Ui(path)
                    break

        if self.ui is None:
            raise Exception("Can't find any .ui-Files to use "
                            "(searched {})".format(', '.join(paths)))

        #
        # search for a .css style sheet file and load it
        #

        css_provider = Gtk.CssProvider()
        context = Gtk.StyleContext()

        css_paths = [
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         'ui/voctogui.css'),
            '/usr/lib/voctogui/ui/voctogui.css'
        ]

        for path in css_paths:
            self.log.debug('trying to load css-file from file %s', path)

            if os.path.isfile(path):
                self.log.info('loading css-file from file %s', path)
                css_provider.load_from_path(path)
                break
        else:
            raise Exception("Can't find any .css-Files to use "
                            "(searched {})".format(', '.join(css_paths)))

        context.add_provider_for_screen(
            Gdk.Screen.get_default(),
            css_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_USER
        )

        self.ui.setup()