def __init__(self, script_data_object): self.script_data_object = copy.deepcopy(script_data_object) self.preview_frame = -1 # -1 used as flag that no preview renders ongoing and new one can be started # Create panels for objects self.editor_widgets = [] editors_list = self.script_data_object["editors_list"] for editor_data in editors_list: name, type, value = editor_data editor_type = int(type) self.editor_widgets.append( _get_editor(editor_type, name, name, value, "")) editors_v_panel = Gtk.VBox(True, 2) for w in self.editor_widgets: editors_v_panel.pack_start(w, False, False, 0) pane = Gtk.VBox(False, 2) if len(self.editor_widgets) != 0: pane.pack_start(editors_v_panel, False, False, 0) else: pane.pack_start(Gtk.Label(_("No Editors for this script")), False, False, 0) # Put in scrollpane if too many editors for screensize. n_editors = len(self.editor_widgets) add_scroll = False if editorstate.screen_size_small_height() == True and n_editors > 4: add_scroll = True h = 500 elif editorstate.screen_size_small_height( ) == True and editorstate.screen_size_large_height( ) == False and n_editors > 5: add_scroll = True h = 600 elif editorstate.screen_size_large_height() == True and n_editors > 6: add_scroll = True h = 700 if add_scroll == True: sw = Gtk.ScrolledWindow() sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) sw.add(pane) sw.set_size_request(400, h) if add_scroll == True: editors_panel = sw else: editors_panel = pane self.editors_panel = editors_panel
def _set_draw_params(): if editorstate.screen_size_small_width() == True: appconsts.NOTEBOOK_WIDTH = 400 editorwindow.MONITOR_AREA_WIDTH = 400 editorwindow.MEDIA_MANAGER_WIDTH = 100 if editorstate.screen_size_small_height() == True: appconsts.TOP_ROW_HEIGHT = 10 projectinfogui.PROJECT_INFO_PANEL_HEIGHT = 140 tlinewidgets.HEIGHT = 252 if editorstate.screen_size_large_height() == True: keyframeeditcanvas.GEOMETRY_EDITOR_HEIGHT = 300 if editorstate.SCREEN_WIDTH < 1153 or editorstate.SCREEN_HEIGHT < 865: editorwindow.MONITOR_AREA_WIDTH = 400 positionbar.BAR_WIDTH = 100 if editorpersistance.prefs.double_track_hights == True: appconsts.TRACK_HEIGHT_NORMAL = 100 # track height in canvas and column appconsts.TRACK_HEIGHT_SMALL = 50 # track height in canvas and column appconsts.TRACK_HEIGHT_SMALLEST = 50 # maybe remove as it is no longer meaningful appconsts.TLINE_HEIGHT = 520 sequence.TRACK_HEIGHT_NORMAL = appconsts.TRACK_HEIGHT_NORMAL # track height in canvas and column sequence.TRACK_HEIGHT_SMALL = appconsts.TRACK_HEIGHT_SMALL # track height in canvas and column tlinewidgets.set_tracks_double_height_consts()
def show_blender_container_clip_program_editor(callback, program_info_json): # Create panels for objects editors = [] blender_objects = program_info_json["objects"] materials = program_info_json["materials"] curves = program_info_json["curves"] objs_panel = _get_panel_and_create_editors(blender_objects, _("Objects"), editors) materials_panel = _get_panel_and_create_editors(materials, _("Materials"), editors) curves_panel = _get_panel_and_create_editors(curves, _("Curves"), editors) pane = Gtk.VBox(False, 2) if objs_panel != None: pane.pack_start(objs_panel, False, False, 0) if materials_panel != None: pane.pack_start(materials_panel, False, False, 0) if curves_panel != None: pane.pack_start(curves_panel, False, False, 0) # Put in scrollpane if too many editors for screensize. n_editors = len(blender_objects) + len(materials) + len(curves) add_scroll = False if editorstate.screen_size_small_height() == True and n_editors > 4: add_scroll = True h = 500 elif editorstate.screen_size_small_height( ) == True and editorste.screen_size_large_height( ) == False and n_editors > 5: add_scroll = True h = 600 elif editorstate.screen_size_large_height() == True and n_editors > 6: add_scroll = True h = 700 if add_scroll == True: sw = Gtk.ScrolledWindow() sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) sw.add(pane) sw.set_size_request(400, h) # Create and show dialog dialog = Gtk.Dialog( _("Blender Project Edit"), gui.editor_window.window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (_("Cancel"), Gtk.ResponseType.REJECT, _("Save Changes"), Gtk.ResponseType.ACCEPT)) if add_scroll == True: alignment = dialogutils.get_default_alignment(sw) else: alignment = dialogutils.get_default_alignment(pane) dialogutils.set_outer_margins(dialog.vbox) dialog.vbox.pack_start(alignment, True, True, 0) dialog.set_default_response(Gtk.ResponseType.REJECT) dialog.set_resizable(False) dialog.connect('response', callback, editors) dialog.show_all()
def __init__(self, callback, clip, container_action, program_info_json): GObject.GObject.__init__(self) self.connect("delete-event", lambda w, e: self.cancel()) self.callback = callback self.clip = clip self.container_action = container_action self.orig_program_info_json = copy.deepcopy( program_info_json ) # We need to sabvre this for 'Cancel'because doing a preview updates edited values # in containeractions.BlenderContainerActions.render_blender_preview(). self.preview_frame = -1 # -1 used as flag that no preview renders ongoing and new one can be started # Create panels for objects editors = [] blender_objects = program_info_json["objects"] materials = program_info_json["materials"] curves = program_info_json["curves"] self.editors = editors objs_panel = _get_panel_and_create_editors(blender_objects, _("Objects"), editors) materials_panel = _get_panel_and_create_editors( materials, _("Materials"), editors) curves_panel = _get_panel_and_create_editors(curves, _("Curves"), editors) pane = Gtk.VBox(False, 2) if objs_panel != None: pane.pack_start(objs_panel, False, False, 0) if materials_panel != None: pane.pack_start(materials_panel, False, False, 0) if curves_panel != None: pane.pack_start(curves_panel, False, False, 0) # Put in scrollpane if too many editors for screensize. n_editors = len(editors) add_scroll = False if editorstate.screen_size_small_height() == True and n_editors > 4: add_scroll = True h = 500 elif editorstate.screen_size_small_height( ) == True and editorstate.screen_size_large_height( ) == False and n_editors > 5: add_scroll = True h = 600 elif editorstate.screen_size_large_height() == True and n_editors > 6: add_scroll = True h = 700 if add_scroll == True: sw = Gtk.ScrolledWindow() sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) sw.add(pane) sw.set_size_request(400, h) if add_scroll == True: editors_panel = sw else: editors_panel = pane cancel_b = guiutils.get_sized_button(_("Cancel"), 150, 32) cancel_b.connect("clicked", lambda w: self.cancel()) save_b = guiutils.get_sized_button(_("Save Changes"), 150, 32) save_b.connect("clicked", lambda w: self.save()) buttons_box = Gtk.HBox(False, 2) buttons_box.pack_start(Gtk.Label(), True, True, 0) buttons_box.pack_start(cancel_b, False, False, 0) buttons_box.pack_start(save_b, False, False, 0) self.preview_panel = PreviewPanel(self, clip) preview_box = Gtk.VBox(False, 2) preview_box.pack_start(self.preview_panel, True, True, 0) preview_box.pack_start(guiutils.pad_label(2, 24), False, False, 0) preview_box.pack_start(buttons_box, False, False, 0) main_box = Gtk.HBox(False, 2) main_box.pack_start( guiutils.get_named_frame(_("Editors"), editors_panel), False, False, 0) main_box.pack_start( guiutils.get_named_frame(_("Preview"), preview_box), False, False, 0) alignment = guiutils.set_margins( main_box, 8, 8, 8, 8) #dialogutils.get_default_alignment(main_box) self.set_modal(True) self.set_transient_for(gui.editor_window.window) self.set_position(Gtk.WindowPosition.CENTER) self.set_title( _("Blender Project Edit - ") + self.container_action.container_data.get_program_name() + ".blend") self.set_resizable(False) self.add(alignment) self.show_all()
def __init__(self, callback, clip, container_action, script_data_object): GObject.GObject.__init__(self) self.connect("delete-event", lambda w, e: self.cancel()) self.callback = callback self.clip = clip self.container_action = container_action self.script_data_object = copy.deepcopy(script_data_object) self.preview_frame = -1 # -1 used as flag that no preview renders ongoing and new one can be started # Create panels for objects self.editor_widgets = [] editors_list = self.script_data_object["editors_list"] for editor_data in editors_list: name, type, value = editor_data editor_type = int(type) self.editor_widgets.append( _get_editor(editor_type, name, name, value, "")) editors_v_panel = Gtk.VBox(True, 2) for w in self.editor_widgets: editors_v_panel.pack_start(w, False, False, 0) pane = Gtk.VBox(False, 2) if len(self.editor_widgets) != 0: pane.pack_start(editors_v_panel, False, False, 0) else: pane.pack_start(Gtk.Label(_("No Editors for this script")), False, False, 0) # Put in scrollpane if too many editors for screensize. n_editors = len(self.editor_widgets) add_scroll = False if editorstate.screen_size_small_height() == True and n_editors > 4: add_scroll = True h = 500 elif editorstate.screen_size_small_height( ) == True and editorstate.screen_size_large_height( ) == False and n_editors > 5: add_scroll = True h = 600 elif editorstate.screen_size_large_height() == True and n_editors > 6: add_scroll = True h = 700 if add_scroll == True: sw = Gtk.ScrolledWindow() sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) sw.add(pane) sw.set_size_request(400, h) if add_scroll == True: editors_panel = sw else: editors_panel = pane cancel_b = guiutils.get_sized_button(_("Cancel"), 150, 32) cancel_b.connect("clicked", lambda w: self.cancel()) save_b = guiutils.get_sized_button(_("Save Changes"), 150, 32) save_b.connect("clicked", lambda w: self.save()) buttons_box = Gtk.HBox(False, 2) buttons_box.pack_start(Gtk.Label(), True, True, 0) buttons_box.pack_start(cancel_b, False, False, 0) buttons_box.pack_start(save_b, False, False, 0) self.preview_panel = PreviewPanel(self, clip) preview_box = Gtk.VBox(False, 2) preview_box.pack_start(self.preview_panel, True, True, 0) preview_box.pack_start(guiutils.pad_label(2, 24), False, False, 0) preview_box.pack_start(buttons_box, False, False, 0) main_box = Gtk.HBox(False, 2) main_box.pack_start( guiutils.get_named_frame(_("Editors"), editors_panel), False, False, 0) main_box.pack_start( guiutils.get_named_frame(_("Preview"), preview_box), False, False, 0) alignment = guiutils.set_margins( main_box, 8, 8, 8, 8) #dialogutils.get_default_alignment(main_box) self.set_modal(True) self.set_transient_for(gui.editor_window.window) self.set_position(Gtk.WindowPosition.CENTER) self.set_title( _("Media Plugin Values Edit - ") + self.container_action.container_data.get_program_name()) self.set_resizable(False) self.add(alignment) self.show_all()