Permalink
Browse files

Added experimental support for 16:9 menues

  • Loading branch information...
Sergio Costas
Sergio Costas committed May 1, 2018
1 parent e70bca5 commit 5c6b98647b61e0d15af0457f3c542c9bd5944dc4
@@ -2,6 +2,7 @@
* version 4.11.0 (2018-05-01)
* Added support for XFBurn
* Added experimental support for 16:9 menues
* version 4.10.0 (2018-04-29)
* Now, when using a custom audio in the menu, it will last the whole audio duration, not 30 seconds
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="margin_bottom">
@@ -39,6 +39,9 @@
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="deletable">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
@@ -257,7 +260,7 @@
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
@@ -321,7 +324,7 @@
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
@@ -424,6 +427,71 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioButton" id="menu_aspect_4_3">
<property name="label" translatable="yes">4:3 (classic)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="menu_aspect_16_9">
<property name="label" translatable="yes">16:9 (widescreen)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">menu_aspect_4_3</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Menu aspect&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
@@ -579,7 +647,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
@@ -623,7 +691,7 @@
<property name="preview_text"/>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
@@ -752,7 +820,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
@@ -857,7 +925,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
@@ -948,7 +1016,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
</object>
@@ -990,7 +1058,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
@@ -494,7 +494,7 @@ def convert_file(self, file_project, output_file, video_length, pass2=False):
self.command_var.append(output_file)
def create_menu_mpeg(self, n_page, background_music, sound_length, pal, video_rate, audio_rate, output_path, use_mp2):
def create_menu_mpeg(self, n_page, background_music, sound_length, pal, video_rate, audio_rate, output_path, use_mp2, widescreen):
self.n_page = n_page
self.final_length = float(sound_length)
@@ -539,7 +539,10 @@ def create_menu_mpeg(self, n_page, background_music, sound_length, pal, video_ra
self.command_var.append("-b:a")
self.command_var.append(str(audio_rate) + "k")
self.command_var.append("-aspect")
self.command_var.append("4:3")
if widescreen:
self.command_var.append("16:9")
else:
self.command_var.append("4:3")
self.command_var.append("-t")
self.command_var.append(str(1 + sound_length))
@@ -34,8 +34,7 @@ def __init__(self):
devedeng.interface_manager.interface_manager.__init__(self)
self.config = devedeng.configuration_data.configuration.get_config()
self.default_background = os.path.join(
self.config.pic_path, "backgrounds", "default_bg.png")
self.default_background = os.path.join(self.config.pic_path, "backgrounds", "default_bg.png")
self.default_sound = os.path.join(self.config.pic_path, "silence.ogg")
self.add_colorbutton("title_color", (0, 0, 0, 1), self.update_preview)
@@ -52,10 +51,9 @@ def __init__(self):
self.add_text("playall_text", _("Play all"), self.update_preview)
self.add_group("position_horizontal", [
"left", "center", "right"], "center", self.update_preview)
self.add_group("at_startup", [
"menu_show_at_startup", "play_first_title_at_startup"], "menu_show_at_startup")
self.add_group("position_horizontal", ["left", "center", "right"], "center", self.update_preview)
self.add_group("at_startup", ["menu_show_at_startup", "play_first_title_at_startup"], "menu_show_at_startup")
self.add_group("menu_aspect_ratio", ["menu_aspect_4_3", "menu_aspect_16_9"], "menu_aspect_4_3", self.on_menu_aspect_changed)
self.add_toggle("play_all_c", False, self.update_preview)
self.add_integer_adjustment("sound_length", 30)
@@ -72,10 +70,8 @@ def __init__(self):
self.add_fontbutton("title_font", "Sans 28", self.update_preview)
self.add_fontbutton("entry_font", "Sans 28", self.update_preview)
self.add_filebutton("background_picture",
self.default_background, self.update_preview)
self.add_filebutton("background_music",
self.default_sound, self.update_music)
self.add_filebutton("background_picture", self.default_background, self.update_preview)
self.add_filebutton("background_music", self.default_sound, self.update_music)
self.cached_menu_font = None
self.cached_menu_size = 0
@@ -346,49 +342,48 @@ def paint_menu(self, paint_background, paint_selected, paint_activated, page_num
coordinates = []
if self.sf is None:
self.sf = cairo.ImageSurface(cairo.FORMAT_ARGB32, 720, int(self.y))
if self.to_png:
self.sf = cairo.ImageSurface(cairo.FORMAT_ARGB32, 720, int(self.y))
else:
self.sf = cairo.ImageSurface(cairo.FORMAT_ARGB32, 720, 540)
self.cr = cairo.Context(self.sf)
if not self.to_png:
if self.menu_aspect_ratio == "menu_aspect_16_9":
self.cr.scale(1.0,405.0 / self.y)
else:
self.cr.scale(1.0,540.0 / self.y)
if self.cached_menu_font != self.entry_font:
# memorize the font sizes
(fontname, fontstyle, fontslant,
fontsize) = self.get_font_params(self.entry_font)
(fontname, fontstyle, fontslant, fontsize) = self.get_font_params(self.entry_font)
self.cr.select_font_face(fontname, fontslant, fontstyle)
self.cr.set_font_size(fontsize)
extents = self.cr.font_extents()
self.cached_menu_size = extents[2]
self.cached_menu_font = self.entry_font
if paint_background:
extra_pixbuf = GdkPixbuf.Pixbuf.new_from_file(
self.background_picture)
extra_pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.background_picture)
extra_x = float(extra_pixbuf.get_width())
extra_y = float(extra_pixbuf.get_height())
self.cr.save()
self.cr.scale(720.0 / extra_x, self.y / extra_y)
surface = Gdk.cairo_surface_create_from_pixbuf(
extra_pixbuf, 1, None)
surface = Gdk.cairo_surface_create_from_pixbuf(extra_pixbuf, 1, None)
self.cr.set_source_surface(surface, 0, 0)
self.cr.paint()
self.cr.restore()
hmargin = self.title_horizontal * 720.0 / 100.0
self.write_text(self.title_text, "title", 0 + hmargin, 720 +
hmargin, self.title_vertical * self.y / 100.0, "center")
# else:
# self.cr.set_source_rgb(1.0,1.0,1.0)
# self.cr.paint()
self.write_text(self.title_text, "title", 0 + hmargin, 720 + hmargin, self.title_vertical * self.y / 100.0, "center")
top_margin_p = self.y * self.margin_top / 100.0
bottom_margin_p = self.y * self.margin_bottom / 100.0
left_margin_p = 720.0 * self.margin_left / 100.0
right_margin_p = 720.0 * self.margin_right / 100.0
entry_height = self.cached_menu_size + \
self.entry_vertical_margin * 2.0 + self.entry_separation
entries_per_page = int(
(self.y - top_margin_p - bottom_margin_p) / entry_height)
entry_height = self.cached_menu_size + self.entry_vertical_margin * 2.0 + self.entry_separation
entries_per_page = int((self.y - top_margin_p - bottom_margin_p) / entry_height)
if (self.play_all_c):
entries_per_page -= 1
n_entries = len(self.title_list)
@@ -518,13 +513,16 @@ def on_previous_page_clicked(self, b):
self.current_shown_page = 0
self.update_preview()
def on_menu_aspect_changed(self, b=None):
self.update_preview()
def on_drawingarea_preview_draw(self, widget, cr):
""" Callback to repaint the menu preview window when it
sends the EXPOSE event """
if (self.sf is None):
self.paint_menu(True, self.wshow_as_selected.get_active(
), False, self.current_shown_page)
self.to_png = False
self.paint_menu(True, self.wshow_as_selected.get_active(), False, self.current_shown_page)
if (self.current_shown_page >= self.pages):
self.current_shown_page = self.pages
@@ -544,12 +542,9 @@ def create_menu_stream(self, path, n_page, coordinates):
# transparent="000000"')
xml_file.write(
'<subpictures>\n\t<stream>\n\t\t<spu force="yes" start="00:00:00.00"')
xml_file.write(' image="' + os.path.join(path, "menu_" +
str(n_page) + '_unselected_bg.png"'))
xml_file.write(' highlight="' + os.path.join(path,
"menu_" + str(n_page) + '_selected_bg.png"'))
xml_file.write(' select="' + os.path.join(path,
"menu_" + str(n_page) + '_active_bg.png"'))
xml_file.write(' image="' + os.path.join(path, "menu_" + str(n_page) + '_unselected_bg.png"'))
xml_file.write(' highlight="' + os.path.join(path, "menu_" + str(n_page) + '_selected_bg.png"'))
xml_file.write(' select="' + os.path.join(path, "menu_" + str(n_page) + '_active_bg.png"'))
xml_file.write(' >\n')
n_elements = 0
has_next = False
@@ -637,26 +632,21 @@ def create_dvd_menus(self, file_list, base_path):
menu_converter = cv.get_menu_converter()
while n_page < self.pages:
self.sf = None
self.to_png = True
coordinates = self.paint_menu(True, False, False, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_bg.png"))
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_bg.png"))
self.sf = None
self.paint_menu(False, False, False, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_unselected_bg.png"))
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_unselected_bg.png"))
self.sf = None
self.paint_menu(False, True, False, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_selected_bg.png"))
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_selected_bg.png"))
self.sf = None
self.paint_menu(False, False, True, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_active_bg.png"))
entry_data = self.create_menu_stream(
menu_folder, n_page, coordinates)
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_active_bg.png"))
entry_data = self.create_menu_stream(menu_folder, n_page, coordinates)
converter = menu_converter()
final_path = converter.create_menu_mpeg(
n_page, self.background_music, self.sound_length, self.config.PAL, self.video_rate, self.audio_rate, menu_folder, self.audio_mp2)
final_path = converter.create_menu_mpeg(n_page, self.background_music, self.sound_length, self.config.PAL, self.video_rate, self.audio_rate, menu_folder, self.audio_mp2, self.menu_aspect_ratio == "menu_aspect_16_9")
entry_data["filename"] = final_path
menu_entries.append(entry_data)
# add this process without dependencies
Oops, something went wrong.

0 comments on commit 5c6b986

Please sign in to comment.