Now allows to add files, remove titles and files.
This commit is contained in:
parent
aa9bc39692
commit
1299c83991
9 changed files with 306 additions and 63 deletions
83
data/interface/wask.ui
Normal file
83
data/interface/wask.ui
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.16.1 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.10"/>
|
||||||
|
<object class="GtkDialog" id="dialog_ask">
|
||||||
|
<property name="width_request">320</property>
|
||||||
|
<property name="height_request">240</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="window_position">center</property>
|
||||||
|
<property name="icon">devede.svg</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<property name="skip_taskbar_hint">True</property>
|
||||||
|
<property name="deletable">False</property>
|
||||||
|
<property name="has_resize_grip">False</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button1">
|
||||||
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button2">
|
||||||
|
<property name="label">gtk-ok</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</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="pack_type">end</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_ask">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="justify">center</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<action-widgets>
|
||||||
|
<action-widget response="0">button1</action-widget>
|
||||||
|
<action-widget response="1">button2</action-widget>
|
||||||
|
</action-widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
|
|
@ -34,8 +34,6 @@
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
<!-- column-name files_element -->
|
<!-- column-name files_element -->
|
||||||
<column type="GObject"/>
|
<column type="GObject"/>
|
||||||
<!-- column-name files_pos -->
|
|
||||||
<column type="gint"/>
|
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="liststore_titles">
|
<object class="GtkListStore" id="liststore_titles">
|
||||||
|
|
@ -50,7 +48,9 @@
|
||||||
<property name="width_request">750</property>
|
<property name="width_request">750</property>
|
||||||
<property name="height_request">440</property>
|
<property name="height_request">440</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Devede</property>
|
||||||
<property name="window_position">center</property>
|
<property name="window_position">center</property>
|
||||||
|
<property name="icon">devede.svg</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box1">
|
<object class="GtkBox" id="box1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
@ -412,6 +412,7 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="model">liststore_files</property>
|
<property name="model">liststore_files</property>
|
||||||
<property name="headers_visible">False</property>
|
<property name="headers_visible">False</property>
|
||||||
|
<signal name="cursor-changed" handler="set_interface_status" swapped="no"/>
|
||||||
<child internal-child="selection">
|
<child internal-child="selection">
|
||||||
<object class="GtkTreeSelection" id="treeview-selection2"/>
|
<object class="GtkTreeSelection" id="treeview-selection2"/>
|
||||||
</child>
|
</child>
|
||||||
|
|
@ -440,7 +441,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="add_chapter">
|
<object class="GtkButton" id="add_file">
|
||||||
<property name="label">gtk-add</property>
|
<property name="label">gtk-add</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -448,6 +449,7 @@
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="image_position">top</property>
|
<property name="image_position">top</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="on_add_file_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
@ -456,7 +458,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="delete_chapter">
|
<object class="GtkButton" id="delete_file">
|
||||||
<property name="label">gtk-remove</property>
|
<property name="label">gtk-remove</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -464,6 +466,7 @@
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="image_position">top</property>
|
<property name="image_position">top</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="on_delete_file_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
@ -472,7 +475,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="down_chapter">
|
<object class="GtkButton" id="down_file">
|
||||||
<property name="label">gtk-go-down</property>
|
<property name="label">gtk-go-down</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -488,7 +491,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="up_chapter">
|
<object class="GtkButton" id="up_file">
|
||||||
<property name="label">gtk-go-up</property>
|
<property name="label">gtk-go-up</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -504,7 +507,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="properties_chapter">
|
<object class="GtkButton" id="properties_file">
|
||||||
<property name="label">gtk-properties</property>
|
<property name="label">gtk-properties</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -520,7 +523,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="preview_chapter">
|
<object class="GtkButton" id="preview_file">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
<!-- column-name files_element -->
|
<!-- column-name files_element -->
|
||||||
<column type="GObject"/>
|
<column type="GObject"/>
|
||||||
<!-- column-name files_pos -->
|
|
||||||
<column type="gint"/>
|
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="liststore_titles">
|
<object class="GtkListStore" id="liststore_titles">
|
||||||
|
|
@ -44,15 +42,15 @@
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
<!-- column-name title_element -->
|
<!-- column-name title_element -->
|
||||||
<column type="GObject"/>
|
<column type="GObject"/>
|
||||||
<!-- column-name title_pos -->
|
|
||||||
<column type="gint"/>
|
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkWindow" id="wmain_window">
|
<object class="GtkWindow" id="wmain_window">
|
||||||
<property name="width_request">750</property>
|
<property name="width_request">750</property>
|
||||||
<property name="height_request">440</property>
|
<property name="height_request">440</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Devede</property>
|
||||||
<property name="window_position">center</property>
|
<property name="window_position">center</property>
|
||||||
|
<property name="icon">devede.svg</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box1">
|
<object class="GtkBox" id="box1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
@ -414,6 +412,7 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="model">liststore_files</property>
|
<property name="model">liststore_files</property>
|
||||||
<property name="headers_visible">False</property>
|
<property name="headers_visible">False</property>
|
||||||
|
<signal name="cursor-changed" handler="set_interface_status" swapped="no"/>
|
||||||
<child internal-child="selection">
|
<child internal-child="selection">
|
||||||
<object class="GtkTreeSelection" id="treeview-selection2"/>
|
<object class="GtkTreeSelection" id="treeview-selection2"/>
|
||||||
</child>
|
</child>
|
||||||
|
|
@ -442,7 +441,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="add_chapter">
|
<object class="GtkButton" id="add_file">
|
||||||
<property name="label">gtk-add</property>
|
<property name="label">gtk-add</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -450,6 +449,7 @@
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="image_position">top</property>
|
<property name="image_position">top</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="on_add_file_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
@ -458,7 +458,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="delete_chapter">
|
<object class="GtkButton" id="delete_file">
|
||||||
<property name="label">gtk-remove</property>
|
<property name="label">gtk-remove</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -474,7 +474,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="down_chapter">
|
<object class="GtkButton" id="down_file">
|
||||||
<property name="label">gtk-go-down</property>
|
<property name="label">gtk-go-down</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -490,7 +490,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="up_chapter">
|
<object class="GtkButton" id="up_file">
|
||||||
<property name="label">gtk-go-up</property>
|
<property name="label">gtk-go-up</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -506,7 +506,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="properties_chapter">
|
<object class="GtkButton" id="properties_file">
|
||||||
<property name="label">gtk-properties</property>
|
<property name="label">gtk-properties</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -522,7 +522,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="preview_chapter">
|
<object class="GtkButton" id="preview_file">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
<object class="GtkWindow" id="wselect_disk">
|
<object class="GtkWindow" id="wselect_disk">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="window_position">center</property>
|
<property name="window_position">center</property>
|
||||||
|
<property name="icon">devede.svg</property>
|
||||||
<signal name="delete-event" handler="on_wselect_disk_delete_event" swapped="no"/>
|
<signal name="delete-event" handler="on_wselect_disk_delete_event" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box1">
|
<object class="GtkBox" id="box1">
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
<requires lib="gtk+" version="3.10"/>
|
<requires lib="gtk+" version="3.10"/>
|
||||||
<object class="GtkWindow" id="wselect_disk">
|
<object class="GtkWindow" id="wselect_disk">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="window_position">center</property>
|
||||||
|
<property name="icon_name">devede.svg</property>
|
||||||
<signal name="delete-event" handler="on_wselect_disk_delete_event" swapped="no"/>
|
<signal name="delete-event" handler="on_wselect_disk_delete_event" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box1">
|
<object class="GtkBox" id="box1">
|
||||||
|
|
|
||||||
45
src/devede/ask.py
Normal file
45
src/devede/ask.py
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
|
||||||
|
#
|
||||||
|
# This file is part of DeVeDe-NG
|
||||||
|
#
|
||||||
|
# DeVeDe-NG is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# DeVeDe-NG is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
from gi.repository import Gtk
|
||||||
|
import os
|
||||||
|
|
||||||
|
class ask_window:
|
||||||
|
|
||||||
|
def __init__(self,paths):
|
||||||
|
|
||||||
|
self.paths = paths
|
||||||
|
|
||||||
|
def run(self,text,title):
|
||||||
|
|
||||||
|
builder = Gtk.Builder()
|
||||||
|
builder.set_translation_domain("devede_ng")
|
||||||
|
|
||||||
|
builder.add_from_file(os.path.join(self.paths.glade,"wask.ui"))
|
||||||
|
builder.connect_signals(self)
|
||||||
|
wask_window = builder.get_object("dialog_ask")
|
||||||
|
wask_window.set_title(title)
|
||||||
|
wask_text = builder.get_object("label_ask")
|
||||||
|
wask_text.set_markup(text)
|
||||||
|
|
||||||
|
wask_window.show_all()
|
||||||
|
retval = wask_window.run()
|
||||||
|
wask_window.destroy()
|
||||||
|
if (retval == 1):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
33
src/devede/file.py
Normal file
33
src/devede/file.py
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
|
||||||
|
#
|
||||||
|
# This file is part of DeVeDe-NG
|
||||||
|
#
|
||||||
|
# DeVeDe-NG is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# DeVeDe-NG is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
from gi.repository import GObject
|
||||||
|
|
||||||
|
class file(GObject.GObject):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
|
||||||
|
GObject.GObject.__init__(self)
|
||||||
|
self.counter2 = 0
|
||||||
|
|
||||||
|
def delete_file(self):
|
||||||
|
|
||||||
|
print("Deleted file "+self.file_name)
|
||||||
|
|
||||||
|
def properties(self):
|
||||||
|
|
||||||
|
self.file_name = "Hola"
|
||||||
|
|
@ -19,7 +19,8 @@ from gi.repository import Gtk
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import devede.title
|
import devede.title
|
||||||
|
import devede.file
|
||||||
|
import devede.ask
|
||||||
|
|
||||||
class devede_project:
|
class devede_project:
|
||||||
|
|
||||||
|
|
@ -48,11 +49,11 @@ class devede_project:
|
||||||
self.wup_title = None
|
self.wup_title = None
|
||||||
self.wdown_title = None
|
self.wdown_title = None
|
||||||
self.wproperties_title = None
|
self.wproperties_title = None
|
||||||
self.wadd_chapter = None
|
self.wadd_file = None
|
||||||
self.wdelete_chapter = None
|
self.wdelete_file = None
|
||||||
self.wup_chapter = None
|
self.wup_file = None
|
||||||
self.wdown_chapter = None
|
self.wdown_file = None
|
||||||
self.wproperties_chapter = None
|
self.wproperties_file = None
|
||||||
self.wcreate_disc = None
|
self.wcreate_disc = None
|
||||||
|
|
||||||
devede.title.counter = 0
|
devede.title.counter = 0
|
||||||
|
|
@ -128,10 +129,23 @@ class devede_project:
|
||||||
|
|
||||||
self.get_current_title()
|
self.get_current_title()
|
||||||
|
|
||||||
new_title = devede.title.title()
|
new_title = devede.title.title(self.wfiles,self.wliststore_files)
|
||||||
self.wliststore_titles.append([new_title.title_name, new_title])
|
self.wliststore_titles.append([new_title.title_name, new_title])
|
||||||
self.set_interface_status(None)
|
self.set_interface_status(None)
|
||||||
|
|
||||||
|
def on_add_file_clicked(self,b):
|
||||||
|
|
||||||
|
(element, position, model, treeiter) = self.get_current_title()
|
||||||
|
if (element == None):
|
||||||
|
return
|
||||||
|
|
||||||
|
new_file = devede.file.file()
|
||||||
|
new_file.properties()
|
||||||
|
|
||||||
|
if (new_file.file_name != None):
|
||||||
|
element.add_file(new_file)
|
||||||
|
self.set_interface_status(None)
|
||||||
|
|
||||||
|
|
||||||
def on_delete_title_clicked(self,b):
|
def on_delete_title_clicked(self,b):
|
||||||
|
|
||||||
|
|
@ -139,9 +153,23 @@ class devede_project:
|
||||||
if (element == None):
|
if (element == None):
|
||||||
return
|
return
|
||||||
|
|
||||||
element.delete_title()
|
ask_w = devede.ask.ask_window(self.paths)
|
||||||
model.remove(treeiter)
|
if (ask_w.run(_("The title <b>%(X)s</b> will be removed.") % {"X":element.title_name},_("Delete title"))):
|
||||||
self.set_interface_status(None)
|
element.delete_title()
|
||||||
|
model.remove(treeiter)
|
||||||
|
self.set_interface_status(None)
|
||||||
|
|
||||||
|
def on_delete_file_clicked(self,b):
|
||||||
|
|
||||||
|
(element, position, model, treeiter) = self.get_current_file()
|
||||||
|
if (element == None):
|
||||||
|
return
|
||||||
|
|
||||||
|
ask_w = devede.ask.ask_window(self.paths)
|
||||||
|
if (ask_w.run(_("The file <b>%(X)s</b> will be removed.") % {"X":element.file_name},_("Delete file"))):
|
||||||
|
element.delete_file()
|
||||||
|
model.remove(treeiter)
|
||||||
|
self.set_interface_status(None)
|
||||||
|
|
||||||
def on_up_title_clicked(self,b):
|
def on_up_title_clicked(self,b):
|
||||||
|
|
||||||
|
|
@ -178,6 +206,31 @@ class devede_project:
|
||||||
break
|
break
|
||||||
position += 1
|
position += 1
|
||||||
return ( (element, position, model, treeiter) )
|
return ( (element, position, model, treeiter) )
|
||||||
|
else:
|
||||||
|
# If there is no selection, try to select the first one if exists
|
||||||
|
try:
|
||||||
|
first = self.wliststore_titles[0]
|
||||||
|
selection.select_iter(first.iter)
|
||||||
|
return ( (first.model[first.iter][1], 0, first.model, first.iter) )
|
||||||
|
except:
|
||||||
|
return ( (None, -1, None, None) )
|
||||||
|
|
||||||
|
def get_current_file(self):
|
||||||
|
|
||||||
|
""" returns the currently selected file """
|
||||||
|
|
||||||
|
selection = self.wfiles.get_selection()
|
||||||
|
model, treeiter = selection.get_selected()
|
||||||
|
|
||||||
|
if treeiter != None:
|
||||||
|
element = model[treeiter][1]
|
||||||
|
position = 0
|
||||||
|
for row in self.wfiles.get_model():
|
||||||
|
item = row.model[row.iter][1]
|
||||||
|
if element == item:
|
||||||
|
break
|
||||||
|
position += 1
|
||||||
|
return ( (element, position, model, treeiter) )
|
||||||
else:
|
else:
|
||||||
return ( (None, -1, None, None) )
|
return ( (None, -1, None, None) )
|
||||||
|
|
||||||
|
|
@ -191,26 +244,32 @@ class devede_project:
|
||||||
self.wdown_title.set_sensitive(True)
|
self.wdown_title.set_sensitive(True)
|
||||||
self.wproperties_title.set_sensitive(True)
|
self.wproperties_title.set_sensitive(True)
|
||||||
|
|
||||||
self.wadd_chapter.set_sensitive(True)
|
self.wadd_file.set_sensitive(True)
|
||||||
self.wdelete_chapter.set_sensitive(True)
|
self.wdelete_file.set_sensitive(True)
|
||||||
self.wup_chapter.set_sensitive(True)
|
self.wup_file.set_sensitive(True)
|
||||||
self.wdown_chapter.set_sensitive(True)
|
self.wdown_file.set_sensitive(True)
|
||||||
self.wproperties_chapter.set_sensitive(True)
|
self.wproperties_file.set_sensitive(True)
|
||||||
|
self.wpreview_file.set_sensitive(True)
|
||||||
|
|
||||||
self.wcreate_disc.set_sensitive(True)
|
self.wcreate_disc.set_sensitive(True)
|
||||||
|
|
||||||
(element, position, model, treeiter) = self.get_current_title()
|
(element, position, model, treeiter) = self.get_current_title()
|
||||||
|
|
||||||
|
if (self.current_title != element):
|
||||||
|
self.current_title = element
|
||||||
|
element.refresh()
|
||||||
|
|
||||||
if (element == None):
|
if (element == None):
|
||||||
self.wdelete_title.set_sensitive(False)
|
self.wdelete_title.set_sensitive(False)
|
||||||
self.wup_title.set_sensitive(False)
|
self.wup_title.set_sensitive(False)
|
||||||
self.wdown_title.set_sensitive(False)
|
self.wdown_title.set_sensitive(False)
|
||||||
self.wproperties_title.set_sensitive(False)
|
self.wproperties_title.set_sensitive(False)
|
||||||
self.wadd_chapter.set_sensitive(False)
|
self.wadd_file.set_sensitive(False)
|
||||||
self.wdelete_chapter.set_sensitive(False)
|
self.wdelete_file.set_sensitive(False)
|
||||||
self.wup_chapter.set_sensitive(False)
|
self.wup_file.set_sensitive(False)
|
||||||
self.wdown_chapter.set_sensitive(False)
|
self.wdown_file.set_sensitive(False)
|
||||||
self.wproperties_chapter.set_sensitive(False)
|
self.wproperties_file.set_sensitive(False)
|
||||||
|
self.wpreview_file.set_sensitive(False)
|
||||||
else:
|
else:
|
||||||
ntitles = len(self.wliststore_titles)
|
ntitles = len(self.wliststore_titles)
|
||||||
if (ntitles < 2):
|
if (ntitles < 2):
|
||||||
|
|
@ -220,16 +279,21 @@ class devede_project:
|
||||||
if (position == (ntitles-1)):
|
if (position == (ntitles-1)):
|
||||||
self.wdown_title.set_sensitive(False)
|
self.wdown_title.set_sensitive(False)
|
||||||
|
|
||||||
empty_disc = True
|
(element2, position2, model2, treeiter2) = self.get_current_file()
|
||||||
for row in self.wliststore_titles:
|
if (element2 == None):
|
||||||
item = row.model[row.iter][1]
|
self.wdelete_file.set_sensitive(False)
|
||||||
if item.get_number_of_chapters() > 0:
|
self.wup_file.set_sensitive(False)
|
||||||
empty_disc = False
|
self.wdown_file.set_sensitive(False)
|
||||||
break
|
self.wproperties_file.set_sensitive(False)
|
||||||
|
self.wpreview_file.set_sensitive(False)
|
||||||
if (empty_disc):
|
else:
|
||||||
self.wcreate_disc.set_sensitive(False)
|
nfiles = len(self.wfiles.get_model())
|
||||||
|
if (nfiles < 1):
|
||||||
|
self.wdelete_file.set_sensitive(False)
|
||||||
|
if (position2 == 0):
|
||||||
|
self.wup_file.set_sensitive(False)
|
||||||
|
if (position2 == (nfiles-1)):
|
||||||
|
self.wdown_file.set_sensitive(False)
|
||||||
|
|
||||||
|
|
||||||
def show_main_window(self):
|
def show_main_window(self):
|
||||||
|
|
@ -238,6 +302,8 @@ class devede_project:
|
||||||
self.wmain_window.present()
|
self.wmain_window.present()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.current_title = None
|
||||||
|
|
||||||
builder = Gtk.Builder()
|
builder = Gtk.Builder()
|
||||||
builder.set_translation_domain("devede_ng")
|
builder.set_translation_domain("devede_ng")
|
||||||
|
|
||||||
|
|
@ -262,11 +328,12 @@ class devede_project:
|
||||||
self.wup_title = builder.get_object("up_title")
|
self.wup_title = builder.get_object("up_title")
|
||||||
self.wdown_title = builder.get_object("down_title")
|
self.wdown_title = builder.get_object("down_title")
|
||||||
self.wproperties_title = builder.get_object("properties_title")
|
self.wproperties_title = builder.get_object("properties_title")
|
||||||
self.wadd_chapter = builder.get_object("add_chapter")
|
self.wadd_file = builder.get_object("add_file")
|
||||||
self.wdelete_chapter = builder.get_object("delete_chapter")
|
self.wdelete_file = builder.get_object("delete_file")
|
||||||
self.wup_chapter = builder.get_object("up_chapter")
|
self.wup_file = builder.get_object("up_file")
|
||||||
self.wdown_chapter = builder.get_object("down_chapter")
|
self.wdown_file = builder.get_object("down_file")
|
||||||
self.wproperties_chapter = builder.get_object("properties_chapter")
|
self.wproperties_file = builder.get_object("properties_file")
|
||||||
|
self.wpreview_file = builder.get_object("preview_file")
|
||||||
|
|
||||||
self.wcreate_disc = builder.get_object("create_disc")
|
self.wcreate_disc = builder.get_object("create_disc")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,17 +21,26 @@ class title(GObject.GObject):
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self,file_treeview,original_liststore):
|
||||||
|
|
||||||
GObject.GObject.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
|
self.file_treeview = file_treeview
|
||||||
title.counter += 1
|
title.counter += 1
|
||||||
self.title_name = _("Title %(X)d") % {"X":title.counter}
|
self.title_name = _("Title %(X)d") % {"X":title.counter}
|
||||||
self.chapters = Gtk.ListStore()
|
columns = []
|
||||||
|
for iterator in range(0, original_liststore.get_n_columns()):
|
||||||
def get_number_of_chapters(self):
|
columns.append(original_liststore.get_column_type(iterator))
|
||||||
|
self.files = Gtk.ListStore()
|
||||||
return len(self.chapters)
|
self.files.set_column_types(columns)
|
||||||
|
|
||||||
def delete_title(self):
|
def delete_title(self):
|
||||||
|
|
||||||
print("Deleted title "+self.title_name)
|
print("Deleted title "+self.title_name)
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
|
||||||
|
self.file_treeview.set_model(self.files)
|
||||||
|
|
||||||
|
def add_file(self,new_file):
|
||||||
|
|
||||||
|
self.files.append([new_file.file_name, new_file])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue