Commit 4ea9d89f authored by Harish Fulara's avatar Harish Fulara

project: Remove project title functionality

parent 7a8d23ba
Pipeline #17256 failed with stage
in 72 minutes and 19 seconds
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.1 -->
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="adjustment1">
......@@ -215,7 +215,7 @@
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="no">x</property>
<property name="label">x</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -557,25 +557,13 @@
<object class="GtkEntry" id="author_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="title_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_right">10</property>
<property name="hexpand">True</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">3</property>
</packing>
</child>
<child>
......@@ -585,18 +573,6 @@
<property name="halign">start</property>
<property name="label" translatable="yes">Author:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Project title:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
......@@ -611,7 +587,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -621,14 +597,14 @@
<property name="halign">start</property>
<property name="max_length">4</property>
<property name="invisible_char"></property>
<property name="text" translatable="no">1900</property>
<property name="text">1900</property>
<property name="adjustment">adjustment3</property>
<property name="numeric">True</property>
<property name="value">1900</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
......
......@@ -232,8 +232,6 @@ class EditorPerspective(Perspective, Loggable):
self.mainhpaned.set_position(self.settings.mainWindowMainHPanePosition)
self.toplevel_widget.set_position(self.settings.mainWindowVPanePosition)
self.updateTitle()
def _setDefaultPositions(self):
window_width = self.app.gui.get_size()[0]
if self.settings.mainWindowHPanePosition is None:
......@@ -485,10 +483,7 @@ class EditorPerspective(Perspective, Loggable):
# FIXME GES: Reimplement Undo/Redo
# self.app.action_log.checkpoint()
self.updateTitle()
self.save_action.set_enabled(False)
if project.uri is None:
project.uri = uri
def _projectManagerClosingProjectCb(self, project_manager, project):
"""Investigates whether it's possible to close the specified project.
......@@ -597,7 +592,6 @@ class EditorPerspective(Perspective, Loggable):
project.pipeline.deactivatePositionListener()
self.info("Project closed")
self.updateTitle()
if project.loaded:
self._disconnectFromProject(project)
self.timeline_ui.setProject(None)
......@@ -736,12 +730,8 @@ class EditorPerspective(Perspective, Loggable):
asset = GES.Formatter.get_default()
asset_extension = asset.get_meta(GES.META_FORMATTER_EXTENSION)
if not project.name:
chooser.set_current_name(
_("Untitled") + "." + asset_extension + "_tar")
else:
chooser.set_current_name(
project.name + "." + asset_extension + "_tar")
chooser.set_current_name(
project.name + "." + asset_extension + "_tar")
filt = Gtk.FileFilter()
filt.set_name(_("Tar archive"))
......@@ -859,61 +849,11 @@ class EditorPerspective(Perspective, Loggable):
def updateTitle(self):
project = self.app.project_manager.current_project
if project:
if project.name:
name = project.name
else:
name = _("Untitled")
unsaved_mark = ""
if project.hasUnsavedModifications():
unsaved_mark = "*"
title = "%s%s — %s" % (unsaved_mark, name, APPNAME)
else:
title = APPNAME
event_box = Gtk.EventBox()
label = Gtk.Label()
clear_styles(label)
label.set_text(title)
event_box.add(label)
event_box.show_all()
event_box.connect("button-press-event", self.__titleClickCb, project)
self.headerbar.set_custom_title(event_box)
self.app.gui.set_title(title)
def __titleClickCb(self, unused_widget, unused_event, project):
entry = Gtk.Entry()
entry.set_width_chars(100)
entry.set_margin_left(SPACING)
entry.set_margin_right(SPACING)
entry.show()
entry.set_text(project.name)
self.headerbar.set_custom_title(entry)
if project.hasDefaultName():
entry.grab_focus()
else:
entry.grab_focus_without_selecting()
entry.connect("focus-out-event", self.__titleChangedCb, project)
entry.connect("key_release_event", self.__titleTypeCb, project)
def __titleChangedCb(self, widget, event, project):
if not event.window:
# Workaround https://bugzilla.gnome.org/show_bug.cgi?id=757036
return
name = widget.get_text()
if project.name == name:
self.updateTitle()
else:
project.name = name
def __titleTypeCb(self, widget, event, project):
if event.keyval == Gdk.KEY_Return:
self.focusTimeline()
return True
elif event.keyval == Gdk.KEY_Escape:
widget.set_text(project.name)
self.focusTimeline()
return True
return False
unsaved_mark = ""
if project.hasUnsavedModifications():
unsaved_mark = "*"
title = "%s%s — %s" % (unsaved_mark, project.name, APPNAME)
self.headerbar.set_title(title)
class PreviewAssetWindow(Gtk.Window):
......
......@@ -60,7 +60,7 @@ from pitivi.utils.validate import has_validate
from pitivi.utils.widgets import FractionWidget
DEFAULT_NAME = _("New Project")
DEFAULT_NAME = _("Untitled")
ALL_RAW_VIDEO_FORMATS = []
# Starting at 2 as 0 is UNKNOWN and 1 is ENCODED.
......@@ -378,13 +378,13 @@ class ProjectManager(GObject.Object, Loggable):
if not backup:
# Do not emit the signal when autosaving a backup file
self.current_project.setModificationState(False)
self.emit("project-saved", self.current_project, uri)
self.debug('Saved project: %s', uri)
# Update the project instance's uri,
# otherwise, subsequent saves will be to the old uri.
self.info("Setting the project instance's URI to: %s", uri)
self.current_project.uri = uri
self.disable_save = False
self.emit("project-saved", self.current_project, uri)
else:
self.debug('Saved backup: %s', uri)
......@@ -506,7 +506,7 @@ class ProjectManager(GObject.Object, Loggable):
assert self.current_project is None
self.__start_loading_time = time.time()
project = Project(self.app, name=DEFAULT_NAME)
project = Project(self.app)
self.emit("new-project-loading", project)
# setting default values for project metadata
......@@ -620,7 +620,6 @@ class Project(Loggable, GES.Project):
loaded (bool): Whether the project is fully loaded.
Args:
name (Optional[str]): The name of the new empty project.
uri (Optional[str]): The URI of the file where the project should
be loaded from.
......@@ -644,10 +643,10 @@ class Project(Loggable, GES.Project):
"video-size-changed": (GObject.SignalFlags.RUN_LAST, None, ()),
}
def __init__(self, app, name="", uri=None, scenario=None, **unused_kwargs):
def __init__(self, app, uri=None, scenario=None, **unused_kwargs):
Loggable.__init__(self)
GES.Project.__init__(self, uri=uri, extractable_type=GES.Timeline)
self.log("name:%s, uri:%s", name, uri)
self.log("uri:%s", uri)
self.pipeline = None
self.ges_timeline = None
self.uri = uri
......@@ -688,7 +687,6 @@ class Project(Loggable, GES.Project):
self.__awaited_deleted_proxy_targets = set()
# Project property default values
self.register_meta(GES.MetaFlag.READWRITE, "name", name)
self.register_meta(GES.MetaFlag.READWRITE, "author", "")
# The rendering settings.
......@@ -751,13 +749,9 @@ class Project(Loggable, GES.Project):
# Project specific properties
@property
def name(self):
return self.get_meta("name")
@name.setter
def name(self, name):
if name == self.name:
return
self.set_meta("name", name)
if not self.uri:
return DEFAULT_NAME
return os.path.splitext(os.path.basename(self.uri))[0]
@property
def year(self):
......@@ -1408,9 +1402,6 @@ class Project(Loggable, GES.Project):
# The asset is an original which is not being proxied.
self.app.proxy_manager.cancel_job(asset)
def hasDefaultName(self):
return DEFAULT_NAME == self.name
def _commit(self):
"""Logs the operation and commits.
......@@ -1836,7 +1827,6 @@ class ProjectSettingsDialog(object):
self.video_presets_combo = getObj("video_presets_combo")
self.constrain_sar_button = getObj("constrain_sar_button")
self.select_dar_radiobutton = getObj("select_dar_radiobutton")
self.title_entry = getObj("title_entry")
self.author_entry = getObj("author_entry")
self.year_spinbutton = getObj("year_spinbutton")
......@@ -1990,7 +1980,6 @@ class ProjectSettingsDialog(object):
self.audio_presets_combo.set_active_id(matching_audio_preset)
# Metadata
self.title_entry.set_text(self.project.name)
self.author_entry.set_text(self.project.author)
if self.project.year:
year = int(self.project.year)
......@@ -2001,7 +1990,6 @@ class ProjectSettingsDialog(object):
def updateProject(self):
with self.app.action_log.started("change project settings",
toplevel=True):
self.project.name = self.title_entry.get_text()
self.project.author = self.author_entry.get_text()
self.project.year = str(self.year_spinbutton.get_value_as_int())
......
......@@ -617,6 +617,7 @@ class TestProjectSettings(common.TestCase):
def testLoad(self):
project = Project(uri="fake.xges", app=common.create_pitivi_mock())
self.assertEqual(project.name, "fake")
self.assertFalse(project._has_default_video_settings)
self.assertFalse(project._has_default_audio_settings)
......
......@@ -126,25 +126,22 @@ class TestProjectUndo(common.TestCase):
project=self.project,
app=self.app)
def assert_meta(title, author, year):
self.assertEqual(self.project.name, title)
def assert_meta(author, year):
self.assertEqual(self.project.author, author)
self.assertEqual(self.project.year, year)
dialog.title_entry.set_text("t1")
dialog.author_entry.set_text("a1")
dialog.year_spinbutton.set_value(2001)
dialog.updateProject()
assert_meta("t1", "a1", "2001")
assert_meta("a1", "2001")
dialog.title_entry.set_text("t2")
dialog.author_entry.set_text("a2")
dialog.year_spinbutton.set_value(2002)
dialog.updateProject()
assert_meta("t2", "a2", "2002")
assert_meta("a2", "2002")
self.action_log.undo()
assert_meta("t1", "a1", "2001")
assert_meta("a1", "2001")
self.action_log.redo()
assert_meta("t2", "a2", "2002")
assert_meta("a2", "2002")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment