def cb_filechooserbutton_mylib_install_dir(self, button):
new_mylib_install_dir = button.get_filename()
if new_mylib_install_dir != self.mylib_install_dir:
message_dialog = Gtk.MessageDialog(
self.main_window,
0,
Gtk.MessageType.QUESTION,
Gtk.ButtonsType.YES_NO,
_("Installation directory changed")
)
message_dialog.format_secondary_text(_("Do you really want to change installation directory?\n" + \
"All your installed games will be moved to the new location.\nProceed?"))
content_area = message_dialog.get_content_area()
content_area.set_property('margin-left', 10)
content_area.set_property('margin-right', 10)
content_area.set_property('margin-top', 10)
content_area.set_property('margin-bottom', 10)
action_area = message_dialog.get_action_area()
action_area.set_property('spacing', 10)
message_dialog_response = message_dialog.run()
if message_dialog_response == Gtk.ResponseType.YES:
os.system('mv -f ' + self.mylib_install_dir + '/* ' + \
new_mylib_install_dir + ' && rmdir ' + self.mylib_install_dir)
os.system('rm ' + new_mylib_install_dir + '/*/.configured > /dev/null 2>&1')
self.mylib_install_dir = new_mylib_install_dir
elif message_dialog_response == Gtk.ResponseType.NO:
button.set_filename(self.mylib_install_dir)
message_dialog.destroy()
评论列表
文章目录