Skip to content

Commit

Permalink
Ver 2.3.0
Browse files Browse the repository at this point in the history
Ver 2.3.0
  • Loading branch information
yuhsukeogawa authored Aug 28, 2024
1 parent 1af553c commit ea612c9
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 27 deletions.
14 changes: 9 additions & 5 deletions network_sketcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self):
self.click_value_2nd = ''
self.click_value_3rd = ''
self.root = TkinterDnD.Tk()
self.root.title("Network Sketcher ver 2.2.2(b)")
self.root.title("Network Sketcher ver 2.3.0")
self.root.geometry("490x200+100+100")

# Notebook
Expand Down Expand Up @@ -432,6 +432,7 @@ def sub_excel_master_1(self,file_type_array):
self.outFileTxt_L2_3_2 = tk.Entry(self.sub2_1)
self.inFileTxt_L3_3_1 = tk.Entry(self.sub2_1)
self.outFileTxt_L3_3_4_1 = tk.Entry(self.sub2_1)
self.outFileTxt_L3_3_5_1 = tk.Entry(self.sub2_1)
self.inFileTxt_11_1 = tk.Entry(self.sub2_1)
self.outFileTxt_11_2 = tk.Entry(self.sub2_1)
self.outFileTxt_11_3 = tk.Entry(self.sub2_1) # for a bug fix at 2.2.1(c)
Expand Down Expand Up @@ -505,24 +506,27 @@ def sub_excel_master_1(self,file_type_array):
self.sub2_3.grid(row=4, column=0, sticky='W', padx=5, pady=5, ipadx=5, ipady=5)

self.sub2_3_button_1 = tk.Button(self.sub2_3, text="Per Area", font=("", 12), command=lambda: network_sketcher_dev.ns_front_run.click_action(self,'L2-3-2'))
self.sub2_3_button_1.grid(row=6, column=1, sticky='WE', padx=5, pady=2, ipadx=15)
self.sub2_3_button_1.grid(row=6, column=1, sticky='WE', padx=5, pady=2, ipadx=5)
self.sub2_3_button_2 = tk.Button(self.sub2_3, text="Per Device", font=("", 12), command=lambda: network_sketcher_dev.ns_front_run.click_action(self,'L2-3-3'))
self.sub2_3_button_2.grid(row=6, column=2, sticky='WE', padx=5, pady=2)
self.sub2_3_button_2.grid(row=6, column=2, sticky='WE', padx=5, pady=2, ipadx=5)


### run L3-3-x for dev , Create L3 diagram
self.sub2_4 = tk.LabelFrame(self.sub2_2x, text='Layer3 Diagram', font=("", 14), height=1, background="#FEF6F0")
self.sub2_4.grid(row=4, column=3, sticky='W', padx=5, pady=5, ipadx=5, ipady=5)

self.sub2_4_button_1 = tk.Button(self.sub2_4, text="All Areas", font=("", 12), command=lambda: network_sketcher_dev.ns_front_run.click_action(self,'L3-4-1')) # add button at ver 2.3.0
self.sub2_4_button_1.grid(row=6, column=3, sticky='WE', padx=5, pady=2, ipadx=5)

self.sub2_4_button_1 = tk.Button(self.sub2_4, text="Per Area", font=("", 12), command=lambda: network_sketcher_dev.ns_front_run.click_action(self,'L3-3-2'))
self.sub2_4_button_1.grid(row=6, column=3, sticky='WE', padx=15, pady=2, ipadx=15)
self.sub2_4_button_1.grid(row=6, column=4, sticky='WE', padx=5, pady=2, ipadx=5)

### run xx-xx for dev , Create VPN diagram
self.sub2_6 = tk.LabelFrame(self.sub2_2x, text='VPN Diagram', font=("", 14), height=1, background="#FEF6F0")
self.sub2_6.grid(row=4, column=4, columnspan=1, sticky='W', padx=5, pady=5, ipadx=5, ipady=5)

self.sub2_6_button_3 = tk.Button(self.sub2_6, text="VPNs on L1", font=("", 12), command=lambda: self.click_action_sub('self.self.sub2_6_button_1', push_array))
self.sub2_6_button_3.grid(row=10, column=1, sticky='WE', padx=10, pady=2, ipadx=15)
self.sub2_6_button_3.grid(row=10, column=1, sticky='WE', padx=5, pady=2, ipadx=5)

#self.sub2_6_button_4 = tk.Button(self.sub2_6, text="VPN only", font=("", 12), command=lambda: self.click_action_sub('self.self.sub2_6_button_2', push_array))
#self.sub2_6_button_4.grid(row=10, column=2, sticky='WE', padx=5, pady=2, ipadx=15)
Expand Down
45 changes: 45 additions & 0 deletions network_sketcher_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def __init__(self):
self.inFileTxt_L3_3_1 = tk.Entry(stepZero_L3_2)
self.inFileTxt_L3_3_1.grid(row=0, column=1, columnspan=7, sticky="WE", pady=3)
self.outFileTxt_L3_3_4_1 = tk.Entry(stepZero_L3_2)
self.outFileTxt_L3_3_5_1 = tk.Entry(stepZero_L3_2)
inFileBtn_L3_3_1 = tk.Button(stepZero_L3_2, text="Browse ...", command=lambda: self.click_action('L3-3-1'))
inFileBtn_L3_3_1.grid(row=0, column=8, sticky='W', padx=5, pady=2)
self.outFileTxt_L3_3_1 = tk.Entry(stepZero_L3_2)
Expand Down Expand Up @@ -478,6 +479,7 @@ def __init__(self):
root.mainloop()

def click_action(self,click_value):
self.click_value_l3 = ''
if click_value == '1-1': # select browse
fTyp = [("", ".pptx")]
iDir = os.path.abspath(os.path.dirname(sys.argv[0]))
Expand Down Expand Up @@ -1204,5 +1206,48 @@ def click_action(self,click_value):
# view complete
ns_def.messagebox_file_open(self.output_ppt_file)

if click_value == 'L3-4-1': # For All Areas L3 Diagram at ver 2.3.0
import ns_l3_diagram_create


full_filepath = self.inFileTxt_L3_3_1.get()
iDir = os.path.dirname(full_filepath)
basename_without_ext = os.path.splitext(os.path.basename(full_filepath))[0]

self.outFileTxt_L3_3_4_1.delete(0, tkinter.END)
self.outFileTxt_L3_3_4_1.insert(tk.END, iDir + ns_def.return_os_slash() + '[L3_DIAGRAM]AllAreas_' + basename_without_ext.replace('[MASTER]', '') + '.pptx')
self.outFileTxt_L3_3_5_1.delete(0, tkinter.END)
self.outFileTxt_L3_3_5_1.insert(tk.END, iDir + ns_def.return_os_slash() + basename_without_ext.replace('[MASTER]', '__TMP__[MASTER]') + '.xlsx')
self.output_ppt_file = self.outFileTxt_L3_3_4_1.get()
self.excel_maseter_file_backup = self.outFileTxt_L3_3_5_1.get()

# check : file is being opened
if ns_def.check_file_open(self.outFileTxt_L3_3_4_1.get()) == True:
return ()

# remove exist L3 file and backup xlsx file
if os.path.isfile(self.outFileTxt_L3_3_4_1.get()) == True:
os.remove(self.outFileTxt_L3_3_4_1.get())

if os.path.isfile(self.outFileTxt_L3_3_5_1.get()) == True:
os.remove(self.outFileTxt_L3_3_5_1.get())

# Create a master file that merges multiple areas into one area
ns_l3_diagram_create.create_master_file_one_area.__init__(self)

# Create a one ppt page of file containing all areas of the L3 diagram
self.click_value = 'L3-3-2'
self.click_value_l3 = 'L3-4-1'
self.global_wp_array = []

ns_l3_diagram_create.ns_l3_diagram_create.__init__(self)

# remove exist L3 file and backup xlsx file
if os.path.isfile(self.outFileTxt_L3_3_5_1.get()) == True:
os.remove(self.outFileTxt_L3_3_5_1.get())

# view complete
ns_def.messagebox_file_open(self.output_ppt_file)

if __name__ == '__main__':
ns_front_run()
13 changes: 9 additions & 4 deletions ns_ddx_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ def add_root_folder(self):
self.shape = self.shape.add_shape(MSO_SHAPE.RECTANGLE, Inches(self.root_folder[0]), Inches(self.root_folder[1]), Inches(self.root_folder[2]), Inches(self.root_folder[3]))
#style fill
shape_fill = self.shape.fill
shape_fill = shape_fill.background()

#chage outline coler to 255,255,255 at ver 2.3.0
#shape_fill = shape_fill.background()
shape_fill.solid()
shape_fill.fore_color.rgb = RGBColor(255, 255, 255)

# style line
shape_line = self.shape.line
shape_line.color.rgb = RGBColor(0, 0, 0)
Expand Down Expand Up @@ -2727,13 +2732,13 @@ def add_shape(self,shape_type,shape_left, shape_top, shape_width, shape_hight,sh
self.shape.text_frame.paragraphs[0].font.color.rgb = RGBColor(0, 0, 0)

elif shape_type == 'OUTLINE_NORMAL':
#fill paramter
shape_fill.background()
#fill paramter change color to 255,255,255 at ver 2.3.0
#shape_fill.background()
shape_fill.fore_color.rgb = RGBColor(255, 255, 255)
# line paramter
shape_line.width = Pt(1.0)
shape_line.color.rgb = RGBColor(0, 0, 0)
self.shape.adjustments[0] = float(0.0) # curve of ROUNDED_RECTANGLE 0.0~1.0
# text parameter

elif shape_type == 'IP_ADDRESS_TAG':
#fill paramter
Expand Down
7 changes: 6 additions & 1 deletion ns_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,11 @@ def convert_master_to_array(ws_name, ppt_meta_file,section_name):
else:
empty_count = 0

if empty_count >= 100:
### Add IF section_name == '<<POSITION_TAG>>' for large map at 2.3.0
if empty_count >= 100 and section_name == '<<POSITION_TAG>>':
flag_finish = True
end_row = current_row
elif empty_count >= 3000:
flag_finish = True
end_row = current_row
current_row += 1
Expand Down Expand Up @@ -1593,6 +1597,7 @@ def get_l2seg_count_on_if(self,device_name,if_name):
def get_opposite_if(self,device_name,if_name):
for tmp_position_line_tuple in self.position_line_tuple:
if tmp_position_line_tuple[0] != 1 and tmp_position_line_tuple[0] != 2:
#print(self.position_line_tuple)
tmp_if_array_1 = split_portname(self.position_line_tuple[tmp_position_line_tuple[0],3])
tmp_if_name_1 = str(self.position_line_tuple[tmp_position_line_tuple[0],13]) + ' ' + tmp_if_array_1[1]
tmp_if_array_2 = split_portname(self.position_line_tuple[tmp_position_line_tuple[0],4])
Expand Down
2 changes: 1 addition & 1 deletion ns_l2_table_from_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self):
'''
make L2 Table excel file
'''
print('### ns_l2_table_from_master() ###')
print('--- ns_l2_table_from_master() ---')
#parameter
ws_name = 'Master_Data'
tmp_ws_name = '_tmp_'
Expand Down
Loading

0 comments on commit ea612c9

Please sign in to comment.