33 from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QToolButton
35 from classes.logger
import log
36 from classes.settings
import get_settings
37 from classes.app
import get_app
48 painter = QPainter(self)
49 painter.setRenderHint(QPainter.Antialiasing)
53 path.addRoundedRect(QRectF(31, 0, self.width()-31, self.height()), 10, 10)
54 painter.setPen(Qt.NoPen)
55 painter.fillPath(path, QColor(
"#53a0ed"))
56 painter.drawPath(path)
60 path.addRoundedRect(QRectF(32, 1, self.width()-33, self.height()-2), 10, 10)
61 painter.setPen(Qt.NoPen)
62 painter.fillPath(path, QColor(
"#424242"))
63 painter.drawPath(path)
69 path.lineTo (31, 35 - arrow_height)
70 path.lineTo (31, (35 - arrow_height) + (arrow_height * 2))
72 painter.fillPath(path, QColor(
"#53a0ed"))
73 painter.drawPath(path)
76 if e.type() == QEvent.WindowActivate:
87 x = self.position_widget.mapToGlobal(self.position_widget.pos()).x()
88 y = self.position_widget.mapToGlobal(self.position_widget.pos()).y()
91 def __init__(self, text, position_widget, x_offset, y_offset, *args):
93 QWidget.__init__(self, *args)
106 vbox.setContentsMargins(32,10,10,10)
110 self.label.setText(text)
111 self.label.setTextFormat(Qt.RichText)
112 self.label.setWordWrap(
True)
114 self.label.setStyleSheet(
"margin: 10px; margin-left: 20px")
115 vbox.addWidget(self.
label)
119 hbox.setContentsMargins(20,0,0,0)
123 self.btn_close_tips.setText(_(
"Hide Tutorial"))
125 self.btn_next_tip.setText(_(
"Next"))
126 self.btn_next_tip.setStyleSheet(
"font-weight:bold;")
135 self.setMinimumWidth(350)
136 self.setMinimumHeight(100)
139 self.setWindowTitle(
"Tutorial")
140 self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint)
141 self.setAttribute(Qt.WA_TranslucentBackground,
True)
142 self.setFocusPolicy(Qt.NoFocus)
148 self.installEventFilter(self)
158 log.info(
"process tutorial dialogs")
168 tutorial_id = tutorial_details[
"id"]
169 tutorial_object = tutorial_details[
"object"]
170 tutorial_text = tutorial_details[
"text"]
171 tutorial_x_offset = tutorial_details[
"x"]
172 tutorial_y_offset = tutorial_details[
"y"]
179 tutorial_dialog =
TutorialDialog(tutorial_text, tutorial_object, tutorial_x_offset, tutorial_y_offset)
182 tutorial_dialog.btn_next_tip.clicked.connect(functools.partial(self.
next_tip, tutorial_id))
183 tutorial_dialog.btn_close_tips.clicked.connect(functools.partial(self.
hide_tips, tutorial_id,
True))
187 self.current_dialog.show()
204 log.info(
"hide_tips")
210 tutorial_id = tutorial_object[
"id"]
211 if tutorial_id == tid:
216 self.tutorial_ids.append(str(tid))
223 s.set(
"tutorial_enabled",
False)
229 self.current_dialog.hide()
236 self.win.dockFiles.visibilityChanged.disconnect()
237 self.win.dockTransitions.visibilityChanged.disconnect()
238 self.win.dockEffects.visibilityChanged.disconnect()
239 self.win.dockProperties.visibilityChanged.disconnect()
240 self.win.dockVideo.visibilityChanged.disconnect()
252 self.current_dialog.showNormal()
253 self.current_dialog.raise_()
259 self.current_dialog.moveWidget()
264 log.info(
"minimize tutorial")
266 self.current_dialog.showMinimized()
286 for toolbutton
in self.win.toolBar.children():
287 if type(toolbutton) == QToolButton
and toolbutton.defaultAction()
and toolbutton.defaultAction().objectName() ==
"actionExportVideo":
288 export_button = toolbutton
291 self.
tutorial_objects = [ {
"id":
"1",
"x":20,
"y":0,
"object":self.win.filesTreeView,
"text":_(
"<b>Project Files:</b> Get started with your project by adding video, audio, and image files here. Drag and drop files from your file system.")},
292 {
"id":
"2",
"x":200,
"y":-15,
"object":self.win.timeline,
"text":_(
"<b>Timeline:</b> Arrange your clips on the timeline here. Overlap clips to create automatic transitions. Access lots of fun presets and options by right-clicking on clips.")},
293 {
"id":
"3",
"x":150,
"y":100,
"object":self.win.dockVideoContents,
"text":_(
"<b>Video Preview:</b> Watch your timeline video preview here. Use the buttons (play, rewind, fast-forward) to control the video playback.")},
294 {
"id":
"4",
"x":20,
"y":-35,
"object":self.win.propertyTableView,
"text":_(
"<b>Properties:</b> View and change advanced properties of clips and effects here. Right-clicking on clips is usually faster than manually changing properties.")},
295 {
"id":
"5",
"x":20,
"y":10,
"object":self.win.transitionsTreeView,
"text":_(
"<b>Transitions:</b> Create a gradual fade from one clip to another. Drag and drop a transition onto the timeline and position it on top of a clip (usually at the beginning or ending).")},
296 {
"id":
"6",
"x":20,
"y":20,
"object":self.win.effectsTreeView,
"text":_(
"<b>Effects:</b> Adjust brigthness, contrast, saturation, and add exciting special effects. Drag and drop an effect onto the timeline and position it on top of a clip (or track)")},
297 {
"id":
"7",
"x":-265,
"y":-22,
"object":export_button,
"text":_(
"<b>Export Video:</b> When you are ready to create your finished video, click this button to export your timeline as a single video file.")}
301 self.win.dockFiles.visibilityChanged.connect(functools.partial(self.
process,
"dockFiles"))
302 self.win.dockTransitions.visibilityChanged.connect(functools.partial(self.
process,
"dockTransitions"))
303 self.win.dockEffects.visibilityChanged.connect(functools.partial(self.
process,
"dockEffects"))
304 self.win.dockProperties.visibilityChanged.connect(functools.partial(self.
process,
"dockProperties"))
305 self.win.dockVideo.visibilityChanged.connect(functools.partial(self.
process,
"dockVideo"))
def get_app()
Returns the current QApplication instance of OpenShot.
def __init__(self, win)
Constructor.
def close_dialogs(self)
Close any open tutorial dialogs.
def re_show_dialog(self)
Re show an active dialog.
def minimize(self)
Minimize any visible tutorial dialog.
Manage and present a list of tutorial dialogs.
A QWidget used to instruct a user how to use a certain feature.
def process(self, parent_name=None)
Process and show the first non-completed tutorial.
def hide_tips(self, tid, user_clicked=False)
Hide the current tip, and don't show anymore.
def moveWidget(self)
Move widget next to its position widget.
def exit_manager(self)
Disconnect from all signals, and shutdown tutorial manager.
def paintEvent(self, event, args)
Custom paint event.
def get_settings()
Get the current QApplication's settings instance.
def re_position_dialog(self)
Reposition a tutorial dialog next to another widget.
def __init__(self, text, position_widget, x_offset, y_offset, args)
def eventFilter(self, object, e)
def next_tip(self, tid)
Mark the current tip completed, and show the next one.