Skip to content

Commit

Permalink
deuxieme comit
Browse files Browse the repository at this point in the history
  • Loading branch information
patatedeouf committed Sep 25, 2023
1 parent d0417ef commit 98ccdb4
Show file tree
Hide file tree
Showing 9 changed files with 569 additions and 1,182 deletions.
847 changes: 538 additions & 309 deletions dxf_viewer/gui_mpl.py → dxf_viewer/app.py

Large diffs are not rendered by default.

654 changes: 0 additions & 654 deletions dxf_viewer/divers/acad2ogree.ipynb

This file was deleted.

210 changes: 0 additions & 210 deletions dxf_viewer/divers/main.py

This file was deleted.

3 changes: 0 additions & 3 deletions dxf_viewer/divers/requirements.txt

This file was deleted.

37 changes: 31 additions & 6 deletions dxf_viewer/divers/tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import time
from tkinter import *
import tkinter as tk


def transform(vertices, new_center, axis1, axis2):
mat = np.linalg.inv(np.array([axis1, axis2])) @ np.array([[1, 0], [0, 1]])
Expand Down Expand Up @@ -88,7 +89,6 @@ def wrapper(*args, **kwargs):
last_call_time = current_time
return result
return wrapper

return decorator


Expand All @@ -108,11 +108,11 @@ def showtip(self, text):
x, y, cx, cy = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 30
y = y + cy + self.widget.winfo_rooty() + 30
self.tipwindow = tw = Toplevel(self.widget)
self.tipwindow = tw = tk.Toplevel(self.widget)
tw.wm_overrideredirect(1)
tw.wm_geometry("+%d+%d" % (x, y))
label = Label(tw, text=self.text, justify=LEFT,
background="#ffffe0", relief=SOLID, borderwidth=1,
label = tk.Label(tw, text=self.text, justify=tk.LEFT,
background="#ffffe0", relief=tk.SOLID, borderwidth=1,
font=("tahoma", "8", "normal"))
label.pack(ipadx=1)

Expand Down Expand Up @@ -141,4 +141,29 @@ def generate_json(name,points):
def get_file_name(file_path):
file_path_components = file_path.split('/')
file_name_and_extension = file_path_components[-1].rsplit('.', 1)
return file_name_and_extension[0]
return file_name_and_extension[0]

class DragDropListbox(tk.Listbox):
""" A Tkinter listbox with drag'n'drop reordering of entries. """
def __init__(self, master, **kw):
kw['selectmode'] = tk.SINGLE
tk.Listbox.__init__(self, master, kw)
self.bind('<Button-1>', self.setCurrent)
self.bind('<B1-Motion>', self.shiftSelection)
self.curIndex = None

def setCurrent(self, event):
self.curIndex = self.nearest(event.y)

def shiftSelection(self, event):
i = self.nearest(event.y)
if i < self.curIndex:
x = self.get(i)
self.delete(i)
self.insert(i+1, x)
self.curIndex = i
elif i > self.curIndex:
x = self.get(i)
self.delete(i)
self.insert(i-1, x)
self.curIndex = i
Binary file added dxf_viewer/graphic/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dxf_viewer/graphic/polyline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dxf_viewer/graphic/sel_point.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dxf_viewer/requirements.txt
Binary file not shown.

0 comments on commit 98ccdb4

Please sign in to comment.