How to use the classes.logger.log function in classes

To help you get started, we’ve selected a few classes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenShot / openshot-qt / src / classes / timeline.py View on Github external
def MaxSizeChangedCB(self, new_size):
        """Callback for max sized change (i.e. max size of video widget)"""
        while not self.window.initialized:
            log.info('Waiting for main window to initialize before calling SetMaxSize')
            time.sleep(0.5)

        log.info("Adjusting max size of preview image: %s" % new_size)

        # Clear timeline preview cache (since our video size has changed)
        self.timeline.ClearAllCache()

        # Set new max video size (Based on preview widget size)
        self.timeline.SetMaxSize(new_size.width(), new_size.height())

        # Refresh current frame (since the entire timeline was updated)
        self.window.refreshFrameSignal.emit()
github OpenShot / openshot-qt / src / windows / models / credits_model.py View on Github external
def update_model(self, filter=None, clear=True):
        log.info("updating credits model.")
        app = get_app()
        _ = app._tr

        # Get window to check filters
        win = app.window

        # Clear all items
        if clear:
            log.info('cleared credits model')
            self.model.clear()

        # Add Headers
        self.model.setHorizontalHeaderLabels(["", "", _("Name"), _("Email"), _("Website")])

        for person in self.credits_list:
            # Get details of person
            name = ""
            if "name" in person.keys():
                name = person["name"] or ""
            email = ""
            if "email" in person.keys():
                email = person["email"] or ""
            website = ""
            if "website" in person.keys():
                website = person["website"] or ""
github OpenShot / openshot-qt / src / classes / ui_util.py View on Github external
def init_ui(window):
    """ Initialize all child widgets and action of a window or dialog """
    log.info('Initializing UI for {}'.format(window.objectName()))

    try:
        # Set locale & window title on the window object
        if hasattr(window, 'setWindowTitle') and window.windowTitle() != "":
            _translate = QApplication.instance().translate
            window.setWindowTitle(_translate("", window.windowTitle()))

            # Center window
            center(window)

        # Loop through all widgets
        for widget in window.findChildren(QWidget):
            init_element(window, widget)

        # Loop through all actions
        for action in window.findChildren(QAction):
github OpenShot / openshot-qt / src / windows / export_video.py View on Github external
def choose_folder_output(self):
        """ Choose a folder for the render """

        app = get_app()
        _ = app._tr

        output_path = QFileDialog.getExistingDirectory(self, _("Choose Export Directory..."),
                                                       self.lbldestination.text())

        if len(output_path) > 0:
            self.lbldestination.setText(output_path)
            log.info("Exported project to {}".format(output_path))
github OpenShot / openshot-qt / src / classes / settings.py View on Github external
def set(self, key, value):
        """ Store setting, but adding isn't allowed. All possible settings must be in default settings file. """
        key = key.lower()

        # Load user setting's values (for easy merging)
        user_values = {}
        for item in self._data:
            if "setting" in item and "value" in item:
                user_values[item["setting"].lower()] = item

        # Save setting
        if key in user_values:
            user_values[key]["value"] = value
        else:
            log.warn("{} key '{}' not valid. The following are valid: {}".format(self.data_type, key,
                                                                                 list(self._data.keys())))
github OpenShot / openshot-qt / src / classes / waveform.py View on Github external
def get_audio_data(clip_id, file_path, channel_filter, volume_keyframe):
    """Get a Clip object form libopenshot, and grab audio data"""
    clip = openshot.Clip(file_path)
    clip.Open()

    # Disable video stream (for speed improvement)
    clip.Reader().info.has_video = False

    log.info("Clip loaded, start thread")
    t = threading.Thread(target=get_waveform_thread, args=[clip, clip_id, file_path, channel_filter, volume_keyframe])
    t.start()
github OpenShot / openshot-qt / src / windows / views / blender_listview.py View on Github external
def error_with_blender(self, version=None, command_output=None):
        """ Show a friendly error message regarding the blender executable or version. """
        _ = self.app._tr
        s = settings.get_settings()

        version_message = ""
        if version:
            version_message = _("\n\nVersion Detected:\n{}").format(version)
            log.error("Blender version detected: {}".format(version))

        if command_output:
            version_message = _("\n\nError Output:\n{}").format(command_output)
            log.error("Blender error output:\n{}".format(command_output))

        msg = QMessageBox()
        msg.setText(_(
            "Blender, the free open source 3D content creation suite is required for this action (http://www.blender.org).\n\nPlease check the preferences in OpenShot and be sure the Blender executable is correct.  This setting should be the path of the 'blender' executable on your computer.  Also, please be sure that it is pointing to Blender version {} or greater.\n\nBlender Path:\n{}{}").format(
            info.BLENDER_MIN_VERSION, s.get("blender_command"), version_message))
        msg.exec_()

        # Enable the Render button again
        self.enable_interface()
github OpenShot / openshot-qt / src / windows / models / titles_model.py View on Github external
def update_model(self, clear=True):
        log.info("updating title model.")
        app = get_app()

        # Get window to check filters
        win = app.window
        _ = app._tr

        # Clear all items
        if clear:
            self.model_paths = {}
            self.model.clear()

        # Add Headers
        self.model.setHorizontalHeaderLabels([_("Thumb"), _("Name")])

        # get a list of files in the OpenShot /transitions directory
        titles_dir = os.path.join(info.PATH, "titles")
github OpenShot / openshot-qt / src / classes / assets.py View on Github external
# Create asset title folder
            asset_titles_folder = os.path.join(asset_path, "title")
            if not os.path.exists(asset_titles_folder):
                os.mkdir(asset_titles_folder)
                log.info("New titles folder: {}".format(asset_titles_folder))

            # Create asset blender folder
            asset_blender_folder = os.path.join(asset_path, "blender")
            if not os.path.exists(asset_blender_folder):
                os.mkdir(asset_blender_folder)
                log.info("New blender folder: {}".format(asset_blender_folder))

        return asset_path

    except Exception as ex:
        log.error("Error while getting/creating asset folder {}: {}".format(asset_path, ex))
github OpenShot / openshot-qt / src / windows / models / clip_properties_model.py View on Github external
def update_model(self, filter=""):
		log.info("updating clip properties model.")
		app = get_app()
		
		# Clear previous model data (if any)
		self.model.clear()

		# Add Headers
		self.model.setHorizontalHeaderLabels(["Property", "Value" ])
		
		# Get a generic emtpy clip
		if self.selected:
			c = self.selected[0]
			
			# example code to add a keyframe
			#c.alpha.AddPoint(1, 1.0);
			#c.alpha.AddPoint(750, 0.0);
			#c.location_x.AddPoint(1, 100.0);