Skip to content

Commit

Permalink
Merge pull request #47 from cisco-open/Ver-2.3.4
Browse files Browse the repository at this point in the history
Ver 2.3.4
  • Loading branch information
yuhsukeogawa authored Dec 23, 2024
2 parents b406298 + 7dabe65 commit 9a7ab8e
Show file tree
Hide file tree
Showing 20 changed files with 649 additions and 298 deletions.
26 changes: 11 additions & 15 deletions network_sketcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self):
self.click_value_3rd = ''
self.click_value_VPN = ''
self.root = TkinterDnD.Tk()
self.root.title("Network Sketcher ver 2.3.3(b)")
self.root.title("Network Sketcher ver 2.3.4")
self.root.geometry("490x200+100+100")

# Notebook
Expand Down Expand Up @@ -680,26 +680,22 @@ def sub_master_extention_2(self):
self.sub3_5.geometry(geo)

self.sub3_5_0 = tk.Label(self.sub3_5, text=local_filename, font=("", 12), background="#FFFFFF")
self.sub3_5_0 .grid(row=0, column=0, columnspan=7, sticky='W', padx=5, pady=5, ipadx=30, ipady=5)
self.sub3_5_0 .grid(row=0, column=0, columnspan=7, sticky='W', padx=5, pady=5, ipadx=30, ipady=15)

# IP Address report
self.sub3_5_1 = tk.LabelFrame(self.sub3_5, text='IP Address report', font=("", 14), height=1, background="#C2E2EC")
self.sub3_5_1 = tk.LabelFrame(self.sub3_5, text='Export', font=("", 14), height=1, background="#C2E2EC")
self.sub3_5_1.grid(row=1, column=0, columnspan=5, sticky='W', padx=5, pady=0, ipadx=3, ipady=0)

# Export to the list file
self.sub3_5_button_1 = tk.Button(self.sub3_5_1, text=" Export to the table file ", font=("", 12), command=lambda: self.click_action_sub('self.sub3_5_button_1','dummy'))
self.sub3_5_button_1.grid(row=6, column=0, sticky='W', padx=30, pady=10)

self.sub3_4_3_entry_1 = tk.Entry(self.sub3_5_1, font=("", 12)) # for report

# Export to the IP Address table
self.sub3_5_button_1 = tk.Button(self.sub3_5_1, text=" IP Address table ", font=("", 12), command=lambda: self.click_action_sub('self.sub3_5_button_1','dummy'))
self.sub3_5_button_1.grid(row=6, column=0, sticky='W', padx=20, pady=5)

def click_action_sub(self, click_value, target_area_name):
if click_value == 'self.sub3_5_button_1': # select Run
if click_value == 'self.sub3_5_button_1': # select IP address table
###export_ip_report
ns_extensions.ip_report.export_ip_report(self, target_area_name)
ns_def.messagebox_file_open(str(self.outFileTxt_11_3.get()))


if click_value == 'self.sub3_4_button_1': # select Run
#change target area name to N/A
if target_area_name == '_WAN(Way_Point)_':
Expand Down Expand Up @@ -736,7 +732,7 @@ def click_action_sub(self, click_value, target_area_name):
ns_def.messagebox_file_open(str(self.outFileTxt_11_2.get()).replace('[MASTER]',''))

if click_value == 'self.self.sub2_6_button_1': # Click "VPNs on L1"
print('--- Click "VPNs on L1" ---')
#print('--- Click "VPNs on L1" ---')
### create L1 Table with [VPNs_on_L1]]
self.click_value = 'VPN-1-1'
network_sketcher_dev.ns_front_run.click_action(self, '2-4-3')
Expand All @@ -747,7 +743,7 @@ def click_action_sub(self, click_value, target_area_name):
ns_def.messagebox_file_open(self.output_ppt_file) #Add at Ver 2.3.1(a)

if click_value == 'self.self.sub2_6_button_2': # Click "VPNs on L3"
print('--- Click VPNs on L3 ---')
#print('--- Click VPNs on L3 ---')
self.click_value = 'L3-4-1'
self.click_value_VPN = 'VPN-1-3'

Expand Down Expand Up @@ -838,7 +834,7 @@ def click_action_sub3_1(self, click_value,push_array):
self.sub3_1_label_4 = tk.Label(self.sub3_1, textvariable=self.text_sub3_1, font=("", 10), background="#E5F4F7")
self.sub3_1_label_4.grid(row=2, column=1, columnspan=3, sticky='W', padx=5, pady=20)
#ns_front_run.sub_excel_master_1(self, file_type_array)
print('Update to the Master file')
print('--- Update to the Master file ---')

### pre-defined for dev parameter
self.inFileTxt_11_1 = tk.Entry(self.sub3_1)
Expand Down Expand Up @@ -946,7 +942,7 @@ def click_action_sub3_1(self, click_value,push_array):
self.click_action_sub('self.self.sub2_5_button_3', push_array)
self.click_value_2nd = ''
if ns_def.return_os_slash() == '\\\\': # add ver 2.1.1 for bug fix on Mac OS
print(' # add ver 2.1.1 for bug fix on Mac OS', ns_def.return_os_slash())
#print(' # add ver 2.1.1 for bug fix on Mac OS', ns_def.return_os_slash())
subprocess.Popen(full_filepath_device, shell=True)

### open master panel
Expand Down
32 changes: 17 additions & 15 deletions network_sketcher_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def __init__(self):

def click_action(self,click_value):
self.click_value_l3 = ''
self.flag_second_page = False # Add at Ver 2.3.4

if click_value == '1-1': # select browse
fTyp = [("", ".pptx")]
Expand Down Expand Up @@ -784,10 +785,25 @@ def click_action(self,click_value):
if ns_def.check_file_open(self.inFileTxt_2_1.get()) == True:
return ()

# import module
# create l1 diagram
import ns_l1_diagram_create
ns_l1_diagram_create.ns_l1_diagram_create.__init__(self)

self.flag_second_page = True # Add at Ver 2.3.4

# create l1 summary_diagram, Add at Ver 2.3.4
if self.click_value == '2-4-3':
import ns_extensions
ns_extensions.summary_diagram.export_summary_diagram(self,'Dummy')

ns_l1_diagram_create.ns_l1_diagram_create.__init__(self)

# remove exist ppt file
if os.path.isfile(self.excel_maseter_file_backup) == True:
os.remove(self.excel_maseter_file_backup)

self.flag_second_page = False # Add at Ver 2.3.4

# view complete
if self.click_value == '2-4-3': #Add at Ver 2.3.1(a)
ns_def.messagebox_file_open(self.output_ppt_file)
Expand Down Expand Up @@ -1009,8 +1025,6 @@ def click_action(self,click_value):
ns_l2_table_from_master.ns_l2_table_from_master_l2_sheet.__init__(self)

input_excel_master_data.close()
# view complete
#tkinter.messagebox.showinfo('info', 'successfully completed')

if click_value == 'L2-2-1': # select browse
fTyp = [("", ".xlsx")]
Expand Down Expand Up @@ -1046,9 +1060,6 @@ def click_action(self,click_value):
import ns_l2_table_sync_master
ns_l2_table_sync_master.ns_l2_table_sync_master.__init__(self)

# view complete
#tkinter.messagebox.showinfo('info', 'successfully completed')

if click_value == 'L2-3-1': # select browse
fTyp = [("", ".xlsx")]
iDir = os.path.abspath(os.path.dirname(sys.argv[0]))
Expand Down Expand Up @@ -1096,7 +1107,6 @@ def click_action(self,click_value):
# view complete
ns_def.messagebox_file_open(self.output_ppt_file)


if click_value == 'L3-1-1': # select browse
fTyp = [("", ".xlsx")]
iDir = os.path.abspath(os.path.dirname(sys.argv[0]))
Expand Down Expand Up @@ -1153,9 +1163,6 @@ def click_action(self,click_value):
iDir = os.path.abspath(os.path.dirname(sys.argv[0]))
self.inFileTxt_L3_2_2_backup= iDir + ns_def.return_os_slash() + os.path.splitext(os.path.basename(self.inFileTxt_L3_2_2.get()))[0] + '_backup' + '.xlsx'

# check : file is being opened
'''if ns_def.check_file_open(self.inFileTxt_L3_2_2.get()) == True:
return ()'''
# confirm to exist device table and master data file
if os.path.isfile(self.inFileTxt_L3_2_1.get()) == False:
tkinter.messagebox.showerror('Error', 'Could not find the L3 Table file')
Expand All @@ -1178,11 +1185,6 @@ def click_action(self,click_value):
self.inFileTxt_L3_3_1.insert(tk.END, full_filepath)

if click_value == 'L3-3-2' or click_value == 'L3-3-3': # select create from master
### TEST MODE ###
#self.inFileTxt_L3_3_1.delete(0, tkinter.END)
#self.inFileTxt_L3_3_1.insert(tk.END, 'C:/work/Network Sketcher/Network Skecher Ver2.0/[MASTER]Sample figure5.xlsx')
#################

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]
Expand Down
49 changes: 34 additions & 15 deletions ns_ddx_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,22 @@ def __init__(self):
else:
self.active_ppt = Presentation()

# width inches of slide master
if (self.root_width + self.root_left * 2) < ppt_min_width:
self.active_ppt.slide_width = Inches(ppt_min_width)
elif (self.root_width + self.root_left * 2) > ppt_max_width:
self.active_ppt.slide_width = Inches(ppt_max_width)
else:
self.active_ppt.slide_width = Inches(self.root_width + self.root_left * 2)
if self.flag_second_page == False:
# width inches of slide master
if (self.root_width + self.root_left * 2) < ppt_min_width:
self.active_ppt.slide_width = Inches(ppt_min_width)
elif (self.root_width + self.root_left * 2) > ppt_max_width:
self.active_ppt.slide_width = Inches(ppt_max_width)
else:
self.active_ppt.slide_width = Inches(self.root_width + self.root_left * 2)

# height inches of slide master
if (self.root_hight + self.root_top * 1.5) < ppt_min_hight:
self.active_ppt.slide_height = Inches(ppt_min_hight)
elif (self.root_hight + self.root_top * 1.5) > ppt_max_hight:
self.active_ppt.slide_height = Inches(ppt_max_hight)
else:
self.active_ppt.slide_height = Inches(self.root_hight + self.root_top * 1.5)
# height inches of slide master
if (self.root_hight + self.root_top * 1.5) < ppt_min_hight:
self.active_ppt.slide_height = Inches(ppt_min_hight)
elif (self.root_hight + self.root_top * 1.5) > ppt_max_hight:
self.active_ppt.slide_height = Inches(ppt_max_hight)
else:
self.active_ppt.slide_height = Inches(self.root_hight + self.root_top * 1.5)

self.input_ppt_mata_excel = openpyxl.load_workbook(ppt_meta_file)

Expand Down Expand Up @@ -280,6 +281,19 @@ def add_sub_folder(self):
self.shape.adjustments[0] = 0.1 # curve of ROUNDED_RECTANGLE 0.0~1.0
self.shape.shadow.inherit = False # disalbe dealut shadow effect

### change folder coler when create summary diagram at ver 2.3.4
if self.flag_second_page == True and self.click_value == '2-4-3':
shape_fill = self.shape.fill
shape_fill.solid()
shape_fill.fore_color.rgb = RGBColor(254, 246, 240)
shape_line.color.rgb = RGBColor(251, 201, 159)
shape_line.width = Pt(2.0)
self.shape.adjustments[0] = 0.3
self.shape.text_frame.paragraphs[0].font.size = Pt(16)




'''change stlye from meta file'''
temp_style_row = 1
temp_style_flag = False
Expand Down Expand Up @@ -362,6 +376,11 @@ def add_sub_folder(self):

temp_style_row += 1

### change folder coler when create summary diagram at ver 2.3.4
if self.flag_second_page == True and self.click_value == '2-4-3':
self.shape.text_frame.paragraphs[0].font.size = Pt(16)
self.shape.text_frame.vertical_anchor = MSO_ANCHOR.MIDDLE

'''run add shapes in own sub folder'''
self.ddx_meta_row_folder = temp_row_folder
self.ddx_meta_col_folder = temp_col_folder + 2
Expand Down Expand Up @@ -527,7 +546,7 @@ def add_shape(self):
self.shape.shadow.inherit = False # disalbe dealut shadow effect

### change style for _AIR_ shape###
if '_AIR_' in temp_shape_text:
if '_AIR_' in temp_shape_text:
shape_line.color.rgb = RGBColor(255, 255, 255)
self.shape.text_frame.paragraphs[0].font.color.rgb = RGBColor(255, 255, 255)

Expand Down
Loading

0 comments on commit 9a7ab8e

Please sign in to comment.