34 from PyQt5.QtGui import QIcon, QStandardItemModel, QStandardItem
39 from classes
import info, ui_util, settings, qt_types, updates
40 from classes.app
import get_app
41 from classes.logger
import log
50 ui_path = os.path.join(info.PATH,
'windows',
'ui',
'profile.ui')
55 QDialog.__init__(self)
71 get_app().window.actionPlay_trigger(
None, force=
"pause")
79 for profile_folder
in [info.USER_PROFILES_PATH, info.PROFILES_PATH]:
80 for file
in os.listdir(profile_folder):
82 profile_path = os.path.join(profile_folder, file)
83 profile = openshot.Profile(profile_path)
86 profile_name =
"%s (%sx%s)" % (profile.info.description, profile.info.width, profile.info.height)
87 self.profile_names.append(profile_name)
91 self.profile_names.sort()
99 self.cboProfile.addItem(profile_name, self.
profile_paths[profile_name])
102 if app.project.get([
'profile'])
in profile_name:
103 selected_index = box_index
110 self.cboProfile.currentIndexChanged.connect(functools.partial(self.
dropdown_index_changed, self.cboProfile))
113 self.cboProfile.setCurrentIndex(selected_index)
117 value = self.cboProfile.itemData(index)
121 profile = openshot.Profile(value)
124 self.lblSize.setText(
"%sx%s" % (profile.info.width, profile.info.height))
125 self.lblFPS.setText(
"%0.2f" % (profile.info.fps.num / profile.info.fps.den))
126 self.lblOther.setText(
"DAR: %s/%s, SAR: %s/%s, Interlaced: %s" % (profile.info.display_ratio.num, profile.info.display_ratio.den, profile.info.pixel_ratio.num, profile.info.pixel_ratio.den, profile.info.interlaced_frame))
129 current_fps =
get_app().project.get([
"fps"])
130 current_fps_float = float(current_fps[
"num"]) / float(current_fps[
"den"])
131 new_fps_float = float(profile.info.fps.num) / float(profile.info.fps.den)
132 fps_factor = new_fps_float / current_fps_float
135 get_app().updates.update([
"profile"], profile.info.description)
136 get_app().updates.update([
"width"], profile.info.width)
137 get_app().updates.update([
"height"], profile.info.height)
138 get_app().updates.update([
"fps"], {
"num" : profile.info.fps.num,
"den" : profile.info.fps.den})
141 if fps_factor != 1.0:
142 get_app().project.rescale_keyframes(fps_factor)
145 get_app().window.timeline_sync.timeline.ApplyMapperToClips()
148 get_app().window.SetWindowTitle(profile.info.description)
151 viewport_rect =
get_app().window.videoPreview.centeredViewport(
get_app().window.videoPreview.width(),
get_app().window.videoPreview.height())
152 get_app().window.timeline_sync.timeline.SetMaxSize(viewport_rect.width(), viewport_rect.height())
155 QTimer.singleShot(500,
get_app().window.refreshFrameSignal.emit)
def track_metric_screen
Track a GUI screen being shown.
def get_app
Returns the current QApplication instance of OpenShot.
def load_ui
Load a Qt *.ui file, and also load an XML parsed version.
def init_ui
Initialize all child widgets and action of a window or dialog.
def dropdown_index_changed
def get_settings
Get the current QApplication's settings instance.