Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 76 additions & 75 deletions classEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ def __init__(self, Main, node, event):
uimanager.add_ui(id, '/popup', '1', '1', Gtk.UIManagerItemType.MENUITEM, False)
id = uimanager.new_merge_id()
uimanager.add_ui(id, '/popup/clear', 'separator',
None, Gtk.UIManagerItemType.SEPARATOR, False)
None, Gtk.UIManagerItemType.SEPARATOR, False)
actiongroup.add_radio_actions([
('0', None, 'Position relative à la corde', None, None, 0),
('1', None, 'Position relative à l\'arc', None, None, 1)
], node.pos_on_curve, node.update_type_coor, (Main, node))
('0', None, 'Position relative à la corde', None, None, 0),
('1', None, 'Position relative à l\'arc', None, None, 1)
], node.pos_on_curve, node.update_type_coor, (Main, node))
uimanager.insert_action_group(actiongroup)

actiongroup.add_toggle_actions([
('Rel', None, 'Relaxer', None, None, node._update_relax, node.rel)
('Rel', None, 'Relaxer', None, None, node._update_relax, node.rel)
], Main)

actiongroup.add_actions([
('Clear', None, 'Supprimer', None, None, node.on_delete)
('Clear', None, 'Supprimer', None, None, node.on_delete)
], (Main, node.id))
Main.popup_menu = uimanager.get_widget('/popup')
Main.popup_menu.popup(None, None, None, None, event.get_button()[1], event.get_time())
Expand All @@ -134,7 +134,7 @@ def __init__(self, Main, node, event):
Main.w2.add_accel_group(accelgroup)
actiongroup = Gtk.ActionGroup('settings')
actiongroup.add_actions([
('Clear', None, 'Supprimer', None, None, node.on_delete)
('Clear', None, 'Supprimer', None, None, node.on_delete)
], (Main, node.id))
uimanager.insert_action_group(actiongroup)
Main.popup_menu = uimanager.get_widget('/popup')
Expand Down Expand Up @@ -175,12 +175,12 @@ def __init__(self, Main, S, event):
except AttributeError:
tag2 = 0
actiongroup.add_toggle_actions([
('Name', None, 'Définir le nom', None, None, S.on_add_name, tag0),
('H', None, 'Définir la hauteur', None, None, S.on_add_h, tag1),
('V', None, 'Définir la distance v', None, None, S.on_add_v, tag2)
('Name', None, 'Définir le nom', None, None, S.on_add_name, tag0),
('H', None, 'Définir la hauteur', None, None, S.on_add_h, tag1),
('V', None, 'Définir la distance v', None, None, S.on_add_v, tag2)
], Main)
actiongroup.add_actions([
('Clear', None, 'Supprimer', None, None, S.on_delete)
('Clear', None, 'Supprimer', None, None, S.on_delete)
], (Main, S.id))
uimanager.insert_action_group(actiongroup)
Main.popup_menu = uimanager.get_widget('/popup')
Expand Down Expand Up @@ -222,12 +222,12 @@ def __init__(self, Main, Mat, event):
except AttributeError:
tag2 = 0
actiongroup.add_toggle_actions([
('Name', None, 'Définir le nom', None, None, Mat.on_add_name, tag0),
('MV', None, 'Définir la masse volumique', None, None, Mat.on_add_mv, tag1),
('Alpha', None, 'Définir le coefficient de dilatation', None, None, Mat.on_add_alpha, tag2)
('Name', None, 'Définir le nom', None, None, Mat.on_add_name, tag0),
('MV', None, 'Définir la masse volumique', None, None, Mat.on_add_mv, tag1),
('Alpha', None, 'Définir le coefficient de dilatation', None, None, Mat.on_add_alpha, tag2)
], Main)
actiongroup.add_actions([
('Clear', None, 'Supprimer', None, None, Mat.on_delete)
('Clear', None, 'Supprimer', None, None, Mat.on_delete)
], (Main, Mat.id))
uimanager.insert_action_group(actiongroup)
Main.popup_menu = uimanager.get_widget('/popup')
Expand Down Expand Up @@ -345,10 +345,10 @@ def __init__(self, Main, b, event):
Main.w2.add_accel_group(accelgroup)
actiongroup = Gtk.ActionGroup('settings')
actiongroup.add_toggle_actions([
('R0', None, 'Relaxer l\'origine', None, None, b._update_relax, b.R0),
('R1', None, 'Relaxer l\'extrémité', None, None, b._update_relax, b.R1),
#('k0', None, 'Rotation élastique de l\'origine', None, None, b.update_k_widget, k0),
#('k1', None, 'Rotation élastique de l\'extrémité', None, None, b.update_k_widget, k1)
('R0', None, 'Relaxer l\'origine', None, None, b._update_relax, b.R0),
('R1', None, 'Relaxer l\'extrémité', None, None, b._update_relax, b.R1),
#('k0', None, 'Rotation élastique de l\'origine', None, None, b.update_k_widget, k0),
#('k1', None, 'Rotation élastique de l\'extrémité', None, None, b.update_k_widget, k1)
], Main)
if isinstance(b, Barre):
if b.R0 and b.R1:
Expand All @@ -365,7 +365,7 @@ def __init__(self, Main, b, event):
uimanager.add_ui(id, '/popup', 'N-', 'N-', Gtk.UIManagerItemType.MENUITEM, False)
id = uimanager.new_merge_id()
uimanager.add_ui(id, '/popup/clear', 'separator',
None, Gtk.UIManagerItemType.SEPARATOR, False)
None, Gtk.UIManagerItemType.SEPARATOR, False)
action = Gtk.ToggleAction("N+", 'Traction seulement', None, None)
action.set_sensitive(is_sensitive)
action.set_active(b.mode == 1 and True or False)
Expand All @@ -386,7 +386,7 @@ def __init__(self, Main, b, event):
action.connect('activate', b.update_k_widget, Main)
actiongroup.add_action(action)
actiongroup.add_actions([
('Clear', None, 'Supprimer', None, None, b.on_delete)
('Clear', None, 'Supprimer', None, None, b.on_delete)
], (Main, b.id))
uimanager.insert_action_group(actiongroup)
Main.popup_menu = uimanager.get_widget('/popup')
Expand Down Expand Up @@ -420,22 +420,22 @@ def __init__(self, Main, char, event):
Main.w2.add_accel_group(accelgroup)
actiongroup = Gtk.ActionGroup('settings')
actiongroup.add_radio_actions([
('0', None, 'Linéique', None, None, 0),
('1', None, 'Projetée', None, None, 1),
('2', None, 'Radiale', None, None, 2)
], char.proj, char.update_arc_type, Main)
('0', None, 'Linéique', None, None, 0),
('1', None, 'Projetée', None, None, 1),
('2', None, 'Radiale', None, None, 2)
], char.proj, char.update_arc_type, Main)

uimanager.insert_action_group(actiongroup)
start = not char.d['x1'] == 0.
end = not char.d['x2'] == 1.
actiongroup.add_toggle_actions([
('Unif', None, 'Charge uniforme', None, None, char.update_unif, char.unif),
('Start', None, 'Ajouter un point de départ', None, None, char.add_start_point, start),
('End', None, 'Ajouter un point de fin', None, None, char.add_end_point, end)
('Unif', None, 'Charge uniforme', None, None, char.update_unif, char.unif),
('Start', None, 'Ajouter un point de départ', None, None, char.add_start_point, start),
('End', None, 'Ajouter un point de fin', None, None, char.add_end_point, end)
], Main)
actiongroup.add_actions([
('Copy', None, 'Copier', None, None, char.copy_char),
('Clear', None, 'Supprimer', None, None, char.on_delete),
('Copy', None, 'Copier', None, None, char.copy_char),
('Clear', None, 'Supprimer', None, None, char.on_delete),
], Main)
Main.popup_menu = uimanager.get_widget('/popup')
Main.popup_menu.popup(None, None, None, None, event.get_button()[1], event.get_time())
Expand Down Expand Up @@ -684,7 +684,7 @@ def set_coors_label(self, data_editor):
self.y = None
return
label.set_text("%s = (%s,%s)" % (self.name, function.PrintValue(x),
function.PrintValue(y)))
function.PrintValue(y)))
self.x = x
self.y = y

Expand Down Expand Up @@ -947,7 +947,7 @@ def set_coors_label(self, data_editor):
label = widgets[7]
if coors:
label.set_text("%s = (%s,%s)" % (self.name, function.PrintValue(coors[0]),
function.PrintValue(coors[1])))
function.PrintValue(coors[1])))
self.x = coors[0]
self.y = coors[1]
else:
Expand Down Expand Up @@ -2540,7 +2540,7 @@ def _get_v_hbox(self, Main):
def _set_profil(self, widget, Main):
"""Affecte les valeurs données par la librairie des profilés"""
if not hasattr(Main, 'profil_manager') \
or Main.profil_manager.window.get_window() is None:
or Main.profil_manager.window.get_window() is None:
return
data = Main.profil_manager.send_data()
if data is None:
Expand Down Expand Up @@ -3030,7 +3030,7 @@ def on_delete(self, widget, args):
def _set_profil(self, widget, Main):
"""Affecte les valeurs données par la librairie des matériaux"""
if not hasattr(Main, 'mat_manager') \
or Main.mat_manager.window.get_window() is None:
or Main.mat_manager.window.get_window() is None:
return
data = Main.mat_manager.send_data()
if data is None:
Expand Down Expand Up @@ -6106,7 +6106,8 @@ def _get_xml_case(self):
status = False
first_case_name = XML["char"].find('case').get("id")
pp = XML["char"].find('case').find('pp')
if pp:

if pp is not None:
status = pp.get("d")
if status == 'true':
status = True
Expand Down Expand Up @@ -6707,15 +6708,15 @@ def _on_switch_page(self, book, page, page_num):

def _ini_di_methode(self):
di = {
0: self._update_units_page,
1: self._ini_node_page,
2: self._ini_barre_page,
3: self._ini_appuis_page,
4: self._ini_sections_page,
5: self._ini_material_page,
6: self._ini_cases_book,
7: self._ini_combi_page,
}
0: self._update_units_page,
1: self._ini_node_page,
2: self._ini_barre_page,
3: self._ini_appuis_page,
4: self._ini_sections_page,
5: self._ini_material_page,
6: self._ini_cases_book,
7: self._ini_combi_page,
}
self._fct = di

def ini_box_dict(self):
Expand Down Expand Up @@ -6802,13 +6803,13 @@ def ini_units_box(self, box):
"""Remplit la zone pour les unités avec les labels et combobox vides"""
combo_box = Gtk.VBox(False, 0)
texts = {'L': "Longueur",
'S': "Section droite",
'E': "Module élastique",
'I': "Moment quadratique",
'F': "Force",
'C': "Contrainte normale",
'M': "Masse volumique"
}
'S': "Section droite",
'E': "Module élastique",
'I': "Moment quadratique",
'F': "Force",
'C': "Contrainte normale",
'M': "Masse volumique"
}
for name, text in texts.items():
hbox = Gtk.HBox(False, 0)
label = Gtk.Label(label="%s :" % text)
Expand Down Expand Up @@ -7241,10 +7242,10 @@ def _ini_node_page(self):
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
viewport = Gtk.Viewport()
viewport.set_events(Gdk.EventMask.POINTER_MOTION_MASK
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
viewport.connect("event", self.onCMenu)
vbox = Gtk.VBox(False, 0)
vbox.set_border_width(20)
Expand Down Expand Up @@ -7508,10 +7509,10 @@ def _ini_barre_page(self, widget=None):
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
viewport = Gtk.Viewport()
viewport.set_events(Gdk.EventMask.POINTER_MOTION_MASK
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
viewport.connect("event", self.onCMenu)
vbox = Gtk.VBox(False, 0)
vbox.set_border_width(20)
Expand Down Expand Up @@ -8187,10 +8188,10 @@ def _ini_sections_page(self):
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
viewport = Gtk.Viewport()
viewport.set_events(Gdk.EventMask.POINTER_MOTION_MASK
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
viewport.connect("event", self.onCMenu)
vbox = Gtk.VBox(False, 0)
vbox.set_border_width(20)
Expand Down Expand Up @@ -8289,10 +8290,10 @@ def _ini_material_page(self):
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
viewport = Gtk.Viewport()
viewport.set_events(Gdk.EventMask.POINTER_MOTION_MASK
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
viewport.connect("event", self.onCMenu)
vbox = Gtk.VBox(False, 0)
vbox.set_border_width(20)
Expand Down Expand Up @@ -8434,10 +8435,10 @@ def _ini_case_page(self, case):
#sw.connect("event", self.onCMenu)
viewport = Gtk.Viewport()
viewport.set_events(Gdk.EventMask.POINTER_MOTION_MASK
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
viewport.connect("event", self.onCMenu)
vbox = Gtk.VBox(False, 0)
vbox.set_border_width(10)
Expand Down Expand Up @@ -8766,10 +8767,10 @@ def _ini_combi_page(self):
sw = Gtk.ScrolledWindow()
viewport = Gtk.Viewport()
viewport.set_events(Gdk.EventMask.POINTER_MOTION_MASK
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
| Gdk.EventMask.BUTTON_PRESS_MASK
| Gdk.EventMask.BUTTON_RELEASE_MASK
| Gdk.EventMask.KEY_PRESS_MASK
| Gdk.EventMask.POINTER_MOTION_HINT_MASK)
viewport.connect("event", self.onCMenu)
#debug_get_props(sw)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
Expand Down