finished registro

This commit is contained in:
Chris Cromer 2019-07-23 22:04:17 -04:00
parent 8dc3bb9915
commit 7e46f7a2c0
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
30 changed files with 1953 additions and 6 deletions

View File

@ -29,3 +29,9 @@ query_gresource = gnome.compile_resources('query_gresource',
c_name: meson.project_name() + '_resource_query', c_name: meson.project_name() + '_resource_query',
export: true, export: true,
install_header: true) install_header: true)
registro_gresource = gnome.compile_resources('registro_gresource',
'registro.gresource.xml',
source_dir: '.',
c_name: meson.project_name() + '_resource_registro',
export: true,
install_header: true)

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<template class="ColegioRegistroAlumnoEdit" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title" translatable="yes">Modificar</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="spacing">25</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label" translatable="yes">Cerrar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="save">
<property name="label" translatable="yes">Guardar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Nota</property>
<property name="justify">right</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="nota">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="max_length">3</property>
<property name="input_purpose">number</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore1"/>
<template class="ColegioRegistroAlumnoList" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title">Alumnos Inscritos</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_height">240</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="alumno_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="model">liststore1</property>
<property name="fixed_height_mode">True</property>
<property name="enable_grid_lines">both</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="selection">
<property name="mode">multiple</property>
<signal name="changed" handler="on_changed_selection" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="rut">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">RUT</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alumno">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Alumno</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="nota">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Nota</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="column_spacing">25</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkButton" id="add_alumno">
<property name="label" translatable="yes">Inscribir</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_alumno">
<property name="label" translatable="yes">Cerrar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete_alumno">
<property name="label" translatable="yes">Eliminar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="edit_alumno">
<property name="label" translatable="yes">Modifiar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 Chris Cromer
~
~ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
~
~ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
~
~ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
~
~ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
~
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<gresources>
<gresource prefix="/cl/cromer/ubb/colegio">
<file preprocess="xml-stripblanks">registro.list.ui</file>
<file preprocess="xml-stripblanks">registro.alumno.list.ui</file>
<file preprocess="xml-stripblanks">registro.alumno.edit.ui</file>
<file preprocess="xml-stripblanks">registro.inscribir.list.ui</file>
</gresource>
</gresources>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore1"/>
<template class="ColegioRegistroInscribirList" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title">Alumnos</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_height">240</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="alumno_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="model">liststore1</property>
<property name="fixed_height_mode">True</property>
<property name="enable_grid_lines">both</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="selection">
<property name="mode">multiple</property>
<signal name="changed" handler="on_changed_selection" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="rut">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">RUT</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="alumno">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Alumno</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="column_spacing">25</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkButton" id="inscribir">
<property name="label" translatable="yes">Inscribir</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_alumno">
<property name="label" translatable="yes">Cerrar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

147
data/ui/registro.list.ui Normal file
View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore1"/>
<template class="ColegioRegistroList" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title">Registro</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_height">240</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="asignatura_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="model">liststore1</property>
<property name="fixed_height_mode">True</property>
<property name="enable_grid_lines">both</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="selection">
<signal name="changed" handler="on_changed_selection" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="asignatura_name">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Nombre de Asignatura</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="teacher">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Profesor</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="column_spacing">25</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkButton" id="edit_asignatura">
<property name="label" translatable="yes">Modificar</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_asignatura">
<property name="label" translatable="yes">Cerrar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -69,7 +69,7 @@ INSERT INTO asignatura
VALUES VALUES
( (
'" + conn.escape (asignatura.nombre) + "', '" + conn.escape (asignatura.nombre) + "',
" + conn.escape (asignatura.profesor.rut_profesor) + " '" + conn.escape (asignatura.profesor.rut_profesor) + "'
) )
RETURNING id_asignatura RETURNING id_asignatura
"); ");

35
src/db/alumno.vala Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio {
namespace DB {
public class Alumno : Object {
public string rut_alumno { get; set; default = ""; }
public string nombres { get; set; default = ""; }
public string apellidos { get; set; default = ""; }
public Alumno (string rut_alumno = "", string nombres = "", string apellidos = "") {
this.rut_alumno = rut_alumno;
this.nombres = nombres;
this.apellidos = apellidos;
}
public void copy (Alumno alumno) {
this.rut_alumno = alumno.rut_alumno;
this.nombres = alumno.nombres;
this.apellidos = apellidos;
}
}
}
}

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Asignatura : Object { public class Asignatura : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Asociado : Object { public class Asociado : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Bloque : Object { public class Bloque : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Ciudad : Object { public class Ciudad : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Curso : Object { public class Curso : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Horario : Object { public class Horario : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Profesor : Object { public class Profesor : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Q1 : Object { public class Q1 : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Q2 : Object { public class Q2 : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Q3 : Object { public class Q3 : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Q4 : Object { public class Q4 : Object {

View File

@ -1,10 +1,24 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Q5 : Object { public class Q5 : Object {
public string nombre { get; set; default = ""; } public string nombre { get; set; default = ""; }
public double promedio { get; set; default = 0.0; } public float promedio { get; set; default = 0; }
public Q5 (string nombre = "", double promedio = 0.0) { public Q5 (string nombre = "", float promedio = 0) {
this.nombre = nombre; this.nombre = nombre;
this.promedio = promedio; this.promedio = promedio;
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Q6 : Object { public class Q6 : Object {

View File

@ -1,3 +1,17 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio { namespace Colegio {
namespace DB { namespace DB {
public class Region : Object { public class Region : Object {

37
src/db/registro.vala Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio {
namespace DB {
public class Registro : Object {
public Asignatura asignatura { get; set; default = new Asignatura (); }
public Alumno alumno { get; set; default = new Alumno (); }
public float nota { get; set; default = 1; }
public Registro (Asignatura asignatura = new Asignatura (), Alumno alumno = new Alumno (), float nota = 1) {
this.asignatura = asignatura;
this.alumno = alumno;
this.nota = nota;
}
public void copy (Registro registro) {
this.nota = registro.nota;
this.asignatura = new Asignatura ();
this.asignatura.copy (registro.asignatura);
this.alumno = new Alumno ();
this.alumno.copy (registro.alumno);
}
}
}
}

View File

@ -33,6 +33,9 @@ namespace Colegio {
[GtkChild] [GtkChild]
private Gtk.MenuItem curso; private Gtk.MenuItem curso;
[GtkChild]
private Gtk.MenuItem registro;
[GtkChild] [GtkChild]
private Gtk.MenuItem q1; private Gtk.MenuItem q1;
@ -79,6 +82,12 @@ namespace Colegio {
asociado_window.initialize (); asociado_window.initialize ();
asociado_window.show_all (); asociado_window.show_all ();
} }
else if (menu_item == registro) {
var registro_window = new RegistroList (application, conn);
registro_window.set_transient_for (this); // Set this window as the parent of the new window
registro_window.initialize ();
registro_window.show_all ();
}
else if (menu_item == q1) { else if (menu_item == q1) {
var query_window = new QueryWindow (application, conn, QueryWindow.Query.Q1); var query_window = new QueryWindow (application, conn, QueryWindow.Query.Q1);
query_window.set_transient_for (this); // Set this window as the parent of the new window query_window.set_transient_for (this); // Set this window as the parent of the new window

View File

@ -27,6 +27,11 @@ vala_sources = files(
'main_window.vala', 'main_window.vala',
'queries.vala', 'queries.vala',
'query_window.vala', 'query_window.vala',
'registro_list.vala',
'registro_alumno_edit.vala',
'registro_alumno_list.vala',
'registro_inscribir_list.vala',
'db/alumno.vala',
'db/asignatura.vala', 'db/asignatura.vala',
'db/asociado.vala', 'db/asociado.vala',
'db/bloque.vala', 'db/bloque.vala',
@ -40,7 +45,8 @@ vala_sources = files(
'db/q4.vala', 'db/q4.vala',
'db/q5.vala', 'db/q5.vala',
'db/q6.vala', 'db/q6.vala',
'db/region.vala') 'db/region.vala',
'db/registro.vala')
sources = vala_sources sources = vala_sources
sources += main_gresource sources += main_gresource
@ -48,6 +54,7 @@ sources += asignatura_gresource
sources += asociado_gresource sources += asociado_gresource
sources += horario_gresource sources += horario_gresource
sources += query_gresource sources += query_gresource
sources += registro_gresource
sources += config_data_file sources += config_data_file
vala_args = ['--vapidir=' + join_paths(meson.source_root(), 'vapi')] vala_args = ['--vapidir=' + join_paths(meson.source_root(), 'vapi')]

View File

@ -320,7 +320,7 @@ GROUP BY (A.nombre);
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
try { try {
var result = new Q5 (wra.get_string_n (i, "nombre"), var result = new Q5 (wra.get_string_n (i, "nombre"),
wra.get_double_n (i, "avg") wra.get_float_n (i, "avg")
); );
list.append (result); list.append (result);
} }
@ -338,7 +338,7 @@ GROUP BY (A.nombre);
list_store.append (out iter); list_store.append (out iter);
list_store.set (iter, list_store.set (iter,
Q5Column.NOMBRE, entry.nombre, Q5Column.NOMBRE, entry.nombre,
Q5Column.PROMEDIO, entry.promedio.to_string ()); Q5Column.PROMEDIO, entry.promedio.to_string ("%.1f"));
}); });
} }
} }

View File

@ -0,0 +1,120 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio {
using Constants;
using Misc;
using DB;
using DB.Wrapper;
using Postgres;
[GtkTemplate (ui = "/cl/cromer/ubb/colegio/registro.alumno.edit.ui")]
public class RegistroAlumnoEdit : Gtk.ApplicationWindow {
private Connection conn;
private Registro registro;
public signal void save_nota ();
[GtkChild]
private Gtk.Entry nota;
[GtkChild]
private Gtk.Button save;
[GtkChild]
private Gtk.Button cancel;
public RegistroAlumnoEdit (Gtk.Application application, Connection conn, Registro registro) {
Object (application: application);
this.conn = conn;
this.registro = registro;
}
[GtkCallback]
public void on_clicked_button (Gtk.Button button) {
if (button == cancel) {
this.close ();
}
else if (button == save) {
update_instance ();
if (validate_data ()) {
try {
var res = conn.db.exec ("
UPDATE registro SET
nota = '" + registro.nota.to_string () + "'
WHERE id_asignatura = " + registro.asignatura.id_asignatura.to_string () + " AND
rut_alumno = '" + conn.escape (registro.alumno.rut_alumno) + "'"
);
if (res.get_status () != ExecStatus.COMMAND_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
catch (PostgresError e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
finally {
save_nota (); // Signal the parent to update itself
this.close ();
}
}
}
}
private bool validate_data () {
if (registro.nota < 1) {
var msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
"Error: La nota no puede ser menor a 1!");
msg.response.connect ((response_id) => {
msg.destroy ();
});
msg.set_title ("Error");
msg.run ();
return false;
}
if (registro.nota > 7) {
var msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
"Error: La nota no puede ser mayor a 7!");
msg.response.connect ((response_id) => {
msg.destroy ();
});
msg.set_title ("Error");
msg.run ();
return false;
}
return true;
}
private void update_instance () {
registro.nota = float.parse (nota.get_text ().strip ());
}
public void initialize () {
nota.set_text (registro.nota.to_string ("%.1f"));
}
}
}

View File

@ -0,0 +1,391 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio {
using Constants;
using Misc;
using DB;
using DB.Wrapper;
using Postgres;
[GtkTemplate (ui = "/cl/cromer/ubb/colegio/registro.alumno.list.ui")]
public class RegistroAlumnoList : Gtk.ApplicationWindow {
private Connection conn;
private Asignatura asignatura;
private enum Column {
RUT,
NAME,
NOTA,
REGISTRO,
N_COLUMNS
}
private Gtk.ListStore list_store;
private List<Registro> registro_list;
[GtkChild]
private Gtk.TreeView alumno_tree;
[GtkChild]
private Gtk.Button add_alumno;
[GtkChild]
private Gtk.Button edit_alumno;
[GtkChild]
private Gtk.Button delete_alumno;
[GtkChild]
private Gtk.Button close_alumno;
[GtkChild]
private Gtk.TreeViewColumn rut;
[GtkChild]
private Gtk.TreeViewColumn alumno;
[GtkChild]
private Gtk.TreeViewColumn nota;
[GtkChild]
private Gtk.TreeSelection selection;
public RegistroAlumnoList (Gtk.Application application, Connection conn, Asignatura asignatura) {
Object (application: application);
this.conn = conn;
this.asignatura = asignatura;
this.set_visible (true); // This fixes: Gtk-CRITICAL **: 23:58:22.139: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
}
[GtkCallback]
public void on_clicked_button (Gtk.Button button) {
if (button == close_alumno) {
this.close ();
}
if (button == edit_alumno) {
Gtk.TreeModel model;
var path = selection.get_selected_rows (out model);
path.foreach ((entry) => {
var tree_row_reference = new Gtk.TreeRowReference (model, entry);
Gtk.TreeIter iter;
list_store.get_iter (out iter, tree_row_reference.get_path ());
Registro registro;
model.get (iter,
Column.REGISTRO, out registro);
var registro_alumno_edit = new RegistroAlumnoEdit (application, conn, registro);
registro_alumno_edit.set_transient_for (this); // Set this window as the parent of the new window
registro_alumno_edit.initialize ();
registro_alumno_edit.show_all ();
registro_alumno_edit.save_nota.connect (on_save);
});
}
else if (button == add_alumno) {
var registro_inscribir_list = new RegistroInscribirList (application, conn, asignatura);
registro_inscribir_list.set_transient_for (this); // Set this window as the parent of the new window
registro_inscribir_list.initialize ();
registro_inscribir_list.show_all ();
registro_inscribir_list.save_inscribir.connect (on_save_inscribir);
}
else if (button == delete_alumno) {
Gtk.MessageDialog msg;
if (selection.count_selected_rows () == 1) {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
"¿Está seguro que quiere eliminar este alumno de la asignatura?");
}
else {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
"¿Está seguro que quiere eliminar estos alumnos de la asignatura?");
}
msg.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.YES:
Gtk.TreeModel model;
var path = selection.get_selected_rows (out model);
path.foreach ((entry) => {
var tree_row_reference = new Gtk.TreeRowReference (model, entry);
Gtk.TreeIter iter;
list_store.get_iter (out iter, tree_row_reference.get_path ());
Registro registro;
model.get (iter,
Column.REGISTRO, out registro);
try {
var res = conn.db.exec ("
DELETE FROM registro
WHERE rut_alumno = '" + conn.escape (registro.alumno.rut_alumno) + "' AND
id_asignatura = " + registro.asignatura.id_asignatura.to_string ());
if (res.get_status () != ExecStatus.COMMAND_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
catch (PostgresError e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
edit_alumno.sensitive = false;
delete_alumno.sensitive = false;
reset_columns ();
list_store.clear ();
update_list_store ();
break;
}
msg.destroy ();
});
msg.show ();
}
}
[GtkCallback]
private void on_changed_selection(Gtk.TreeSelection selection) {
if (selection.count_selected_rows () == 1) {
edit_alumno.sensitive = true;
delete_alumno.sensitive = true;
}
else if (selection.count_selected_rows () > 1) {
edit_alumno.sensitive = false;
delete_alumno.sensitive = true;
}
else {
edit_alumno.sensitive = false;
delete_alumno.sensitive = false;
}
}
[GtkCallback]
private void on_clicked_column (Gtk.TreeViewColumn column) {
edit_alumno.sensitive = false;
delete_alumno.sensitive = false;
if (column == alumno) {
if (!alumno.sort_indicator) {
reset_columns ();
alumno.sort_indicator = true;
}
if (alumno.sort_order == Gtk.SortType.ASCENDING) {
alumno.sort_order = Gtk.SortType.DESCENDING;
}
else {
alumno.sort_order = Gtk.SortType.ASCENDING;
}
registro_list.sort_with_data ((a, b) => {
if (alumno.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.alumno.nombres, b.alumno.nombres);
}
else {
return strcmp (b.alumno.nombres, a.alumno.nombres);
}
});
}
else if (column == rut) {
if (!rut.sort_indicator) {
reset_columns ();
rut.sort_indicator = true;
}
if (rut.sort_order == Gtk.SortType.ASCENDING) {
rut.sort_order = Gtk.SortType.DESCENDING;
}
else {
rut.sort_order = Gtk.SortType.ASCENDING;
}
registro_list.sort_with_data ((a, b) => {
if (rut.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.alumno.rut_alumno, b.alumno.rut_alumno);
}
else {
return strcmp (b.alumno.rut_alumno, a.alumno.rut_alumno);
}
});
}
else if (column == nota) {
if (!nota.sort_indicator) {
reset_columns ();
nota.sort_indicator = true;
}
if (nota.sort_order == Gtk.SortType.ASCENDING) {
nota.sort_order = Gtk.SortType.DESCENDING;
}
else {
nota.sort_order = Gtk.SortType.ASCENDING;
}
registro_list.sort_with_data ((a, b) => {
if (nota.sort_order == Gtk.SortType.ASCENDING) {
if (a.nota < b.nota) {
return -1;
}
else if (a.nota == b.nota) {
return 0;
}
else {
return 1;
}
}
else {
if (a.nota < b.nota) {
return 1;
}
else if (a.nota == b.nota) {
return 0;
}
else {
return -1;
}
}
});
}
list_store.clear ();
registro_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
try {
list_store.set (iter,
Column.RUT, new Misc.Rut(entry.alumno.rut_alumno).get_rut (),
Column.NAME, entry.alumno.nombres + " " + entry.alumno.apellidos,
Column.NOTA, entry.nota.to_string("%.1f"),
Column.REGISTRO, entry);
}
catch (InvalidRut e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
}
private void reset_columns () {
alumno.sort_indicator = false;
alumno.sort_order = Gtk.SortType.DESCENDING;
rut.sort_indicator = false;
rut.sort_order = Gtk.SortType.DESCENDING;
nota.sort_indicator = false;
nota.sort_order = Gtk.SortType.DESCENDING;
}
public void on_save (RegistroAlumnoEdit registro_alumno_edit) {
edit_alumno.sensitive = false;
delete_alumno.sensitive = false;
reset_columns ();
list_store.clear ();
update_list_store ();
}
public void on_save_inscribir (RegistroInscribirList registro_inscribir_list) {
edit_alumno.sensitive = false;
delete_alumno.sensitive = false;
reset_columns ();
list_store.clear ();
update_list_store ();
}
private void update_list_store () {
var res = conn.db.exec ("
SELECT R.nota,
A.rut_alumno, A.nombres, A.apellidos
FROM registro R
JOIN alumno A ON (A.rut_alumno = R.rut_alumno)
WHERE (R.id_asignatura='" + asignatura.id_asignatura.to_string () + "')
");
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
else {
var wra = new ResultWrapper (res);
registro_list = new List<Registro> ();
int n = res.get_n_tuples ();
for (int i = 0; i < n; i++) {
try {
var result = new Registro (
asignatura,
new Alumno (
wra.get_string_n (i, "rut_alumno"),
wra.get_string_n (i, "nombres"),
wra.get_string_n (i, "apellidos")
),
wra.get_float_n (i, "nota")
);
registro_list.append (result);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
registro_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
try {
list_store.set (iter,
Column.RUT, new Misc.Rut(entry.alumno.rut_alumno).get_rut (),
Column.NAME, entry.alumno.nombres + " " + entry.alumno.apellidos,
Column.NOTA, entry.nota.to_string("%.1f"),
Column.REGISTRO, entry);
}
catch (InvalidRut e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
}
}
public void initialize () {
list_store = new Gtk.ListStore (Column.N_COLUMNS,
typeof (string),
typeof (string),
typeof (string),
typeof (Registro));
update_list_store ();
alumno_tree.set_model (list_store);
}
}
}

View File

@ -0,0 +1,292 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio {
using Constants;
using Misc;
using DB;
using DB.Wrapper;
using Postgres;
[GtkTemplate (ui = "/cl/cromer/ubb/colegio/registro.inscribir.list.ui")]
public class RegistroInscribirList : Gtk.ApplicationWindow {
private Connection conn;
private Asignatura asignatura;
public signal void save_inscribir ();
private enum Column {
RUT,
NAME,
ALUMNO,
N_COLUMNS
}
private Gtk.ListStore list_store;
private List<Alumno> alumno_list;
[GtkChild]
private Gtk.TreeView alumno_tree;
[GtkChild]
private Gtk.Button inscribir;
[GtkChild]
private Gtk.Button close_alumno;
[GtkChild]
private Gtk.TreeViewColumn rut;
[GtkChild]
private Gtk.TreeViewColumn alumno;
[GtkChild]
private Gtk.TreeSelection selection;
public RegistroInscribirList (Gtk.Application application, Connection conn, Asignatura asignatura) {
Object (application: application);
this.conn = conn;
this.asignatura = asignatura;
this.set_visible (true); // This fixes: Gtk-CRITICAL **: 23:58:22.139: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
}
[GtkCallback]
public void on_clicked_button (Gtk.Button button) {
if (button == close_alumno) {
this.close ();
}
else if (button == inscribir) {
Gtk.MessageDialog msg;
if (selection.count_selected_rows () == 1) {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
"¿Está seguro que quiere inscribir este alumno a la asignatura?");
}
else {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
"¿Está seguro que quiere inscribir estos alumnos a la asignatura?");
}
msg.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.YES:
Gtk.TreeModel model;
var path = selection.get_selected_rows (out model);
path.foreach ((entry) => {
var tree_row_reference = new Gtk.TreeRowReference (model, entry);
Gtk.TreeIter iter;
list_store.get_iter (out iter, tree_row_reference.get_path ());
Alumno alumno;
model.get (iter,
Column.ALUMNO, out alumno);
try {
var res = conn.db.exec ("
INSERT INTO registro
(rut_alumno, id_asignatura, nota)
VALUES
(
'" + conn.escape (alumno.rut_alumno) + "',
'" + asignatura.id_asignatura.to_string () + "',
'1.0'
)
");
if (res.get_status () != ExecStatus.COMMAND_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
catch (PostgresError e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
finally {
save_inscribir (); // Signal the parent to update itself
this.close ();
}
});
break;
}
msg.destroy ();
});
msg.show ();
}
}
[GtkCallback]
private void on_changed_selection(Gtk.TreeSelection selection) {
if (selection.count_selected_rows () >= 1) {
inscribir.sensitive = true;
}
else {
inscribir.sensitive = false;
}
}
[GtkCallback]
private void on_clicked_column (Gtk.TreeViewColumn column) {
inscribir.sensitive = false;
if (column == alumno) {
if (!alumno.sort_indicator) {
reset_columns ();
alumno.sort_indicator = true;
}
if (alumno.sort_order == Gtk.SortType.ASCENDING) {
alumno.sort_order = Gtk.SortType.DESCENDING;
}
else {
alumno.sort_order = Gtk.SortType.ASCENDING;
}
alumno_list.sort_with_data ((a, b) => {
if (alumno.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.nombres, b.nombres);
}
else {
return strcmp (b.nombres, a.nombres);
}
});
}
else if (column == rut) {
if (!rut.sort_indicator) {
reset_columns ();
rut.sort_indicator = true;
}
if (rut.sort_order == Gtk.SortType.ASCENDING) {
rut.sort_order = Gtk.SortType.DESCENDING;
}
else {
rut.sort_order = Gtk.SortType.ASCENDING;
}
alumno_list.sort_with_data ((a, b) => {
if (rut.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.rut_alumno, b.rut_alumno);
}
else {
return strcmp (b.rut_alumno, a.rut_alumno);
}
});
}
list_store.clear ();
alumno_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
try {
list_store.set (iter,
Column.RUT, new Misc.Rut(entry.rut_alumno).get_rut (),
Column.NAME, entry.nombres + " " + entry.apellidos,
Column.ALUMNO, entry);
}
catch (InvalidRut e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
}
private void reset_columns () {
alumno.sort_indicator = false;
alumno.sort_order = Gtk.SortType.DESCENDING;
rut.sort_indicator = false;
rut.sort_order = Gtk.SortType.DESCENDING;
}
private void update_list_store () {
var res = conn.db.exec ("
SELECT A.rut_alumno, A.nombres, A.apellidos
FROM alumno A
WHERE (A.rut_alumno NOT IN (
SELECT R.rut_alumno
FROM registro R
WHERE (R.id_asignatura='" + asignatura.id_asignatura.to_string () + "')
)
)
");
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
else {
var wra = new ResultWrapper (res);
alumno_list = new List<Alumno> ();
int n = res.get_n_tuples ();
for (int i = 0; i < n; i++) {
try {
var result = new Alumno (
wra.get_string_n (i, "rut_alumno"),
wra.get_string_n (i, "nombres"),
wra.get_string_n (i, "apellidos")
);
alumno_list.append (result);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
alumno_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
try {
list_store.set (iter,
Column.RUT, new Misc.Rut(entry.rut_alumno).get_rut (),
Column.NAME, entry.nombres + " " + entry.apellidos,
Column.ALUMNO, entry);
}
catch (InvalidRut e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
}
}
public void initialize () {
list_store = new Gtk.ListStore (Column.N_COLUMNS,
typeof (string),
typeof (string),
typeof (Alumno));
update_list_store ();
alumno_tree.set_model (list_store);
}
}
}

223
src/registro_list.vala Normal file
View File

@ -0,0 +1,223 @@
/*
* Copyright 2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Colegio {
using Constants;
using Misc;
using DB;
using DB.Wrapper;
using Postgres;
[GtkTemplate (ui = "/cl/cromer/ubb/colegio/registro.list.ui")]
public class RegistroList : Gtk.ApplicationWindow {
private Connection conn;
private enum Column {
NAME,
PROFESOR,
ASIGNATURA,
N_COLUMNS
}
private Gtk.ListStore list_store;
private List<Asignatura> asignatura_list;
[GtkChild]
private Gtk.TreeView asignatura_tree;
[GtkChild]
private Gtk.Button edit_asignatura;
[GtkChild]
private Gtk.Button close_asignatura;
[GtkChild]
private Gtk.TreeViewColumn asignatura_name;
[GtkChild]
private Gtk.TreeViewColumn teacher;
[GtkChild]
private Gtk.TreeSelection selection;
public RegistroList (Gtk.Application application, Connection conn) {
Object (application: application);
this.conn = conn;
this.set_visible (true); // This fixes: Gtk-CRITICAL **: 23:58:22.139: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
}
[GtkCallback]
public void on_clicked_button (Gtk.Button button) {
if (button == close_asignatura) {
this.close ();
}
if (button == edit_asignatura) {
Gtk.TreeModel model;
var path = selection.get_selected_rows (out model);
path.foreach ((entry) => {
var tree_row_reference = new Gtk.TreeRowReference (model, entry);
Gtk.TreeIter iter;
list_store.get_iter (out iter, tree_row_reference.get_path ());
Asignatura asignatura;
model.get (iter,
Column.ASIGNATURA, out asignatura);
var registro_alumno_list = new RegistroAlumnoList (application, conn, asignatura);
registro_alumno_list.set_transient_for (this); // Set this window as the parent of the new window
registro_alumno_list.initialize ();
registro_alumno_list.show_all ();
});
}
}
[GtkCallback]
private void on_changed_selection(Gtk.TreeSelection selection) {
if (selection.count_selected_rows () == 1) {
edit_asignatura.sensitive = true;
}
else if (selection.count_selected_rows () > 1) {
edit_asignatura.sensitive = false;
}
else {
edit_asignatura.sensitive = false;
}
}
[GtkCallback]
private void on_clicked_column (Gtk.TreeViewColumn column) {
edit_asignatura.sensitive = false;
if (column == asignatura_name) {
if (!asignatura_name.sort_indicator) {
reset_columns ();
asignatura_name.sort_indicator = true;
}
if (asignatura_name.sort_order == Gtk.SortType.ASCENDING) {
asignatura_name.sort_order = Gtk.SortType.DESCENDING;
}
else {
asignatura_name.sort_order = Gtk.SortType.ASCENDING;
}
asignatura_list.sort_with_data ((a, b) => {
if (asignatura_name.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.nombre, b.nombre);
}
else {
return strcmp (b.nombre, a.nombre);
}
});
}
else if (column == teacher) {
if (!teacher.sort_indicator) {
reset_columns ();
teacher.sort_indicator = true;
}
if (teacher.sort_order == Gtk.SortType.ASCENDING) {
teacher.sort_order = Gtk.SortType.DESCENDING;
}
else {
teacher.sort_order = Gtk.SortType.ASCENDING;
}
asignatura_list.sort_with_data ((a, b) => {
if (teacher.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.profesor.nombres, b.profesor.nombres);
}
else {
return strcmp (b.profesor.nombres, a.profesor.nombres);
}
});
}
list_store.clear ();
asignatura_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
list_store.set (iter,
Column.NAME, entry.nombre,
Column.PROFESOR, entry.profesor.nombres + " " + entry.profesor.apellidos,
Column.ASIGNATURA, entry);
});
}
private void reset_columns () {
asignatura_name.sort_indicator = false;
asignatura_name.sort_order = Gtk.SortType.DESCENDING;
teacher.sort_indicator = false;
teacher.sort_order = Gtk.SortType.DESCENDING;
}
private void update_list_store () {
var res = conn.db.exec ("
SELECT A.id_asignatura, A.nombre,
P.rut_profesor, P.nombres, P.apellidos
FROM asignatura A
JOIN profesor P ON (P.rut_profesor = A.rut_profesor)
");
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
else {
var wra = new ResultWrapper (res);
asignatura_list = new List<Asignatura> ();
int n = res.get_n_tuples ();
for (int i = 0; i < n; i++) {
try {
var result = new Asignatura (
wra.get_int_n (i, "id_asignatura"),
wra.get_string_n (i, "nombre"),
new Profesor (
wra.get_string_n (i, "rut_profesor"),
wra.get_string_n (i, "nombres"),
wra.get_string_n (i, "apellidos")
)
);
asignatura_list.append (result);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
asignatura_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
list_store.set (iter,
Column.NAME, entry.nombre,
Column.PROFESOR, entry.profesor.nombres + " " + entry.profesor.apellidos,
Column.ASIGNATURA, entry);
});
}
}
public void initialize () {
list_store = new Gtk.ListStore (Column.N_COLUMNS,
typeof (string),
typeof (string),
typeof (Asignatura));
update_list_store ();
asignatura_tree.set_model (list_store);
}
}
}