[pitivi] ui: welcome msg for empty greeter
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ui: welcome msg for empty greeter
- Date: Tue, 10 Jul 2018 12:14:49 +0000 (UTC)
commit d9c8f6c897729ee3ac6efbef9db3e6c0a64bdbca
Author: HarishFulara07 <harish14143 iiitd ac in>
Date: Sun Jul 8 12:39:34 2018 +0530
ui: welcome msg for empty greeter
data/pixmaps/pitivi.png | Bin 0 -> 47256 bytes
data/ui/greeter.ui | 170 ++++++++++++++++++++++++++++---------------
pitivi/greeterperspective.py | 48 ++++++++----
pitivi/utils/ui.py | 9 ++-
4 files changed, 153 insertions(+), 74 deletions(-)
---
diff --git a/data/pixmaps/pitivi.png b/data/pixmaps/pitivi.png
new file mode 100644
index 00000000..dd5726dd
Binary files /dev/null and b/data/pixmaps/pitivi.png differ
diff --git a/data/ui/greeter.ui b/data/ui/greeter.ui
index 2fecb101..edd05b9b 100644
--- a/data/ui/greeter.ui
+++ b/data/ui/greeter.ui
@@ -2,6 +2,67 @@
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
+ <object class="GtkBox" id="recent_projects_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="margin_top">30</property>
+ <property name="margin_bottom">10</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox" id="recent_projects_labelbox">
+ <property name="name">recent_projects_labelbox</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="recent_projects_label">
+ <property name="name">recent_projects_label</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Recent Projects</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="updated_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="margin_right">12</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Updated</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkListBox" id="recent_projects_listbox">
+ <property name="name">recent_projects_listbox</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -11,7 +72,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkBox" id="topvbox">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@@ -69,71 +130,18 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="recent_projects_topvbox">
+ <object class="GtkBox" id="topvbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="margin_top">30</property>
- <property name="margin_bottom">10</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="recent_projects_labelbox">
- <property name="name">recent_projects_labelbox</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkLabel" id="recent_projects_label">
- <property name="name">recent_projects_label</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Recent Projects</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="updated_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="margin_right">12</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">Updated</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkListBox" id="recent_projects_listbox">
- <property name="name">recent_projects_listbox</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -141,4 +149,52 @@
</object>
</child>
</object>
+ <object class="GtkBox" id="welcome_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">pitivi</property>
+ <property name="icon_size">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="name">empty_greeter_msg_title</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">32</property>
+ <property name="label" translatable="yes">Welcome to Pitivi</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="name">empty_greeter_msg_subtitle</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">18</property>
+ <property name="label" translatable="yes">Beautiful, powerful and intuitive movie editor</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/pitivi/greeterperspective.py b/pitivi/greeterperspective.py
index 3bc5adf0..e8469642 100644
--- a/pitivi/greeterperspective.py
+++ b/pitivi/greeterperspective.py
@@ -76,6 +76,9 @@ class GreeterPerspective(Perspective):
self.new_project_action = None
self.open_project_action = None
+ self.__topvbox = None
+ self.__welcome_vbox = None
+ self.__recent_projects_vbox = None
self.__recent_projects_listbox = None
self.__project_filter = self.__create_project_filter()
self.__infobar = None
@@ -91,6 +94,9 @@ class GreeterPerspective(Perspective):
builder.add_from_file(os.path.join(get_ui_dir(), "greeter.ui"))
self.toplevel_widget = builder.get_object("scrolled_window")
+ self.__topvbox = builder.get_object("topvbox")
+ self.__welcome_vbox = builder.get_object("welcome_vbox")
+ self.__recent_projects_vbox = builder.get_object("recent_projects_vbox")
self.__recent_projects_listbox = builder.get_object("recent_projects_listbox")
self.__recent_projects_listbox.set_selection_mode(Gtk.SelectionMode.NONE)
@@ -109,7 +115,32 @@ class GreeterPerspective(Perspective):
def refresh(self):
"""Refreshes the perspective."""
self.toplevel_widget.grab_focus()
- self.__show_recent_projects()
+
+ # Clear the currently displayed list of recent projects.
+ for child in self.__recent_projects_listbox.get_children():
+ self.__recent_projects_listbox.remove(child)
+
+ recent_items = [item for item in self.app.recent_manager.get_items()
+ if item.get_display_name().endswith(self.__project_filter)]
+
+ # If there are recent projects, display them, else display welcome screen.
+ if recent_items:
+ for item in recent_items[:MAX_RECENT_PROJECTS]:
+ self.__recent_projects_listbox.add(ProjectInfoRow(item))
+ self.headerbar.set_title(_("Select a Project"))
+ child = self.__recent_projects_vbox
+ self.__recent_projects_listbox.show_all()
+ else:
+ self.headerbar.set_title("Pitivi")
+ child = self.__welcome_vbox
+
+ children = self.__topvbox.get_children()
+ if children:
+ current_child = children[0]
+ if current_child == child:
+ return
+ self.__topvbox.remove(current_child)
+ self.__topvbox.pack_start(child, False, False, 0)
def __setup_css(self):
css_provider = Gtk.CssProvider()
@@ -122,7 +153,6 @@ class GreeterPerspective(Perspective):
def __create_headerbar(self):
headerbar = Gtk.HeaderBar()
headerbar.set_show_close_button(True)
- headerbar.set_title(_("Select a Project"))
new_project_button = Gtk.Button.new_with_label(_("New"))
new_project_button.set_tooltip_text(_("Create a new project"))
@@ -158,20 +188,6 @@ class GreeterPerspective(Perspective):
self.app.shortcuts.add("greeter.open-project", ["<Primary>o"],
_("Open a project"), group="win")
- def __show_recent_projects(self):
- """Displays recent projects."""
- # Clear the currently displayed list.
- for child in self.__recent_projects_listbox.get_children():
- self.__recent_projects_listbox.remove(child)
-
- recent_items = [item for item in self.app.recent_manager.get_items()
- if item.get_display_name().endswith(self.__project_filter)]
-
- for item in recent_items[:MAX_RECENT_PROJECTS]:
- self.__recent_projects_listbox.add(ProjectInfoRow(item))
-
- self.__recent_projects_listbox.show_all()
-
@staticmethod
def __create_project_filter():
filter_ = []
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 4c28b8be..424b6de6 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -109,6 +109,11 @@ DOCUMENT_FONT = _get_font("document-font-name", "Sans")
MONOSPACE_FONT = _get_font("monospace-font-name", "Monospace")
GREETER_PERSPECTIVE_CSS = """
+ #empty_greeter_msg_title {
+ font-size: 125%;
+ font-weight: bold;
+ }
+
#recent_projects_listbox {
border: 1px solid alpha(@borders, 0.6);
}
@@ -126,7 +131,9 @@ GREETER_PERSPECTIVE_CSS = """
font-weight: bold;
}
- #project_uri_label, #project_last_updated_label {
+ #project_uri_label,
+ #project_last_updated_label,
+ #empty_greeter_msg_subtitle {
opacity: 0.55;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]