8517: Remove copy button from family tree manager

This commit is contained in:
Nick Hall 2015-08-09 18:34:58 +01:00
parent 6ff73c4e36
commit c2e361e7e4
2 changed files with 5 additions and 47 deletions

View File

@ -33,7 +33,6 @@ creating, and deleting of databases.
import os import os
import time import time
import copy import copy
import shutil
import subprocess import subprocess
from urllib.parse import urlparse from urllib.parse import urlparse
@ -131,7 +130,7 @@ class DbManager(CLIDbManager):
if parent: if parent:
self.top.set_transient_for(parent) self.top.set_transient_for(parent)
for attr in ['connect', 'cancel', 'new', 'remove', 'copy', for attr in ['connect', 'cancel', 'new', 'remove',
'dblist', 'rename', 'repair', 'rcs', 'msg']: 'dblist', 'rename', 'repair', 'rcs', 'msg']:
setattr(self, attr, self.glade.get_object(attr)) setattr(self, attr, self.glade.get_object(attr))
@ -160,7 +159,6 @@ class DbManager(CLIDbManager):
self.remove.connect('clicked', self.__remove_db) self.remove.connect('clicked', self.__remove_db)
self.new.connect('clicked', self.__new_db) self.new.connect('clicked', self.__new_db)
self.rename.connect('clicked', self.__rename_db) self.rename.connect('clicked', self.__rename_db)
self.copy.connect('clicked', self.__copy_db)
self.repair.connect('clicked', self.__repair_db) self.repair.connect('clicked', self.__repair_db)
self.selection.connect('changed', self.__selection_changed) self.selection.connect('changed', self.__selection_changed)
self.dblist.connect('button-press-event', self.__button_press) self.dblist.connect('button-press-event', self.__button_press)
@ -217,7 +215,6 @@ class DbManager(CLIDbManager):
if not node: if not node:
self.connect.set_sensitive(False) self.connect.set_sensitive(False)
self.rename.set_sensitive(False) self.rename.set_sensitive(False)
self.copy.set_sensitive(False)
self.rcs.set_sensitive(False) self.rcs.set_sensitive(False)
self.repair.set_sensitive(False) self.repair.set_sensitive(False)
self.remove.set_sensitive(False) self.remove.set_sensitive(False)
@ -249,7 +246,6 @@ class DbManager(CLIDbManager):
self.repair.set_sensitive(False) self.repair.set_sensitive(False)
self.rename.set_sensitive(True) self.rename.set_sensitive(True)
self.copy.set_sensitive(True)
self.remove.set_sensitive(True) self.remove.set_sensitive(True)
self.new.set_sensitive(True) self.new.set_sensitive(True)
@ -415,7 +411,6 @@ class DbManager(CLIDbManager):
""" """
self.connect.set_sensitive(False) self.connect.set_sensitive(False)
self.rename.set_sensitive(False) self.rename.set_sensitive(False)
self.copy.set_sensitive(False)
self.rcs.set_sensitive(False) self.rcs.set_sensitive(False)
self.repair.set_sensitive(False) self.repair.set_sensitive(False)
self.remove.set_sensitive(False) self.remove.set_sensitive(False)
@ -637,28 +632,6 @@ class DbManager(CLIDbManager):
self.name_renderer.set_property('editable', True) self.name_renderer.set_property('editable', True)
self.dblist.set_cursor(path, self.column, True) self.dblist.set_cursor(path, self.column, True)
def __copy_db(self, obj):
"""
Copy the database through low-level file copies.
"""
# First, get the selected tree:
store, node = self.selection.get_selected()
# New title:
date_string = time.strftime("%d %b %Y %H:%M:%S", time.gmtime())
title = _("%(new_DB_name)s (copied %(date_string)s)") % {
'new_DB_name' : store[node][NAME_COL],
'date_string' : date_string }
# Create the row and directory, awaits user edit of title:
(new_dir, title) = self._create_new_db(title, create_db=False)
# Copy the files:
name_file = conv_to_unicode(store[node][FILE_COL], 'utf8')
old_dir = os.path.dirname(name_file)
for filename in os.listdir(old_dir):
if filename == "name.txt":
continue
old_file = os.path.abspath(os.path.join(old_dir, filename))
shutil.copy2(old_file, new_dir)
def __repair_db(self, obj): def __repair_db(self, obj):
""" """
Start the repair process by calling the start_editing option on Start the repair process by calling the start_editing option on

View File

@ -232,21 +232,6 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="copy">
<property name="label" translatable="yes">_Copy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="remove"> <object class="GtkButton" id="remove">
<property name="label" translatable="yes">_Delete</property> <property name="label" translatable="yes">_Delete</property>
@ -260,7 +245,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">2</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -276,7 +261,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">3</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -292,7 +277,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">4</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -308,7 +293,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">5</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
</object> </object>