From ce6b7ba0d424baedb1063bd1483044d42dea8d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Lambert?= Date: Sun, 1 Oct 2023 12:02:15 +0200 Subject: [PATCH] Requirements.txt a jour et fonction pour ajouter des points manuellement --- dxf_viewer/app.py | 94 ++++++++++++++++++------------------ dxf_viewer/requirements.txt | Bin 6590 -> 248 bytes 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/dxf_viewer/app.py b/dxf_viewer/app.py index eb1ca43..9eaaac0 100644 --- a/dxf_viewer/app.py +++ b/dxf_viewer/app.py @@ -1,4 +1,4 @@ - +#Imports import tkinter as tk from tkinter import filedialog import os @@ -6,7 +6,6 @@ import sys import numpy as np from rdp import rdp -import pprint as pp from collections import defaultdict import matplotlib.pyplot as plt import sys @@ -17,32 +16,19 @@ from matplotlib.lines import Line2D from matplotlib.patches import Rectangle from matplotlib.widgets import Cursor -sys.path.append("./divers") -from tools import * import mplcursors from pprint import pprint matplotlib.use('TkAgg') from tkinter.filedialog import asksaveasfile +sys.path.append("./divers") +from tools import * -""" -In this verson, the lower left btton ( supposed to let u add points manually doesnt work ), its to add -also, the export to json func is not working properly i think -The new feature is the lowest box where selected points appaears, -you can select a first bunch of points with the area selection and then add points -one by one with the selector (hand icon) -In the box you can order the points as you want by drag and drop them -The polyline button removes all the non selected point and draw a polyline -between remaining points in the order they are in the box -the line appears not to be close atm -to be fix and can be fix quickly -""" - +# To be done: json export funcion +# Add a button to select ponint to delete from the drawing class App(tk.Tk): - def __init__(self): - + def __init__(self): super().__init__() # create CTk window like you do with the Tk window - self.initial_width = 1600 self.initial_height = 900 self.geometry(f"{self.initial_width}x{self.initial_height}") @@ -83,6 +69,7 @@ def __init__(self): self.lines_to_draw = [] self.point_id = [] + #Menu self.buton_size = 33 #bouton fichier @@ -131,15 +118,16 @@ def __init__(self): self.are_equals = True CreateToolTip(self.json, text = "Export selected points\n" + \ "to Json") - + #bouton add_points self.add_point_border = tk.Frame(self, bg="#d9d9d9") self.add_point_border.place(relx=0.75, rely=0.63, width=self.buton_size+4, height=self.buton_size+4) self.add_point_icone = tk.PhotoImage(file="graphic/plus.png") - self.add_point_button = tk.Button(self.add_point_border, image=self.add_point_icone,command=self.add_point,bg="white") + self.add_point_button = tk.Button(self.add_point_border, image=self.add_point_icone,command=self.on_click_add,bg="white") self.add_point_button.place(x=2,y=2,width=self.buton_size, height=self.buton_size) CreateToolTip(self.add_point_button, text = "Add a Point") + self.add = False #bouton select_point with area @@ -163,7 +151,7 @@ def __init__(self): self.plus_button.place(x=2,y=2,width=self.buton_size, height=self.buton_size) CreateToolTip(self.plus_button, text = "Select points by "+\ "click") - self.adding_points = False + self.selecting_points = False self.selected_points = {} @@ -234,8 +222,6 @@ def __init__(self): self.mainloop() - - ########Fonctions liées au boutons################ #Bouton fichier @@ -365,7 +351,6 @@ def mesurer(self): #Mesure def on_click_mesure(self,event): - if self.point1 == []: if self.close: self.point1 = self.close else: self.point1 = [event.xdata, event.ydata] @@ -411,8 +396,6 @@ def equalize_xy(self): self.horizontal_line = self.ax.axhline(0, color='red', linestyle='--', visible=False, lw=1) self.vertical_line = self.ax.axvline(0, color='red', linestyle='--', visible=False, lw=1) - self.fig.canvas.mpl_connect('motion_notify_event', self.cursor_hover) - self.fig.canvas.mpl_connect('axes_leave_event', self.cursor_leave) self.canvas.draw_idle() #Bouton séléction de points par aire @@ -481,10 +464,9 @@ def choosed_area(self,event,x_start,y_start): if x and y : for c,i in enumerate(self.lines_to_draw): ids_points = self.point_id[c] - if not False in np.equal(i[0,:],i[-1,:]): + if not False in np.equal(i[0,:],i[-1,:]) and np.shape(i)[0]>1: i = i[:-1,:] ids_points = self.point_id[c][:-1] - self.selection += list(i[(i[:,0]>min(x_start,x))*(i[:,0]min(y_start,y))*(i[:,1]min(x_start,x))*(i[:,0]DvWZi(~JyqEe1D=AC_ literal 6590 zcmZ{oTW?!c5QXTmbRjz5E`UDBHMAUzSVZpI6od(-(F`t=QKf< z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