Skip to content

Commit 9a7ab8e

Browse files
authored
Merge pull request #47 from cisco-open/Ver-2.3.4
Ver 2.3.4
2 parents b406298 + 7dabe65 commit 9a7ab8e

20 files changed

+649
-298
lines changed

network_sketcher.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self):
4141
self.click_value_3rd = ''
4242
self.click_value_VPN = ''
4343
self.root = TkinterDnD.Tk()
44-
self.root.title("Network Sketcher ver 2.3.3(b)")
44+
self.root.title("Network Sketcher ver 2.3.4")
4545
self.root.geometry("490x200+100+100")
4646

4747
# Notebook
@@ -680,26 +680,22 @@ def sub_master_extention_2(self):
680680
self.sub3_5.geometry(geo)
681681

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

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

689-
# Export to the list file
690-
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'))
691-
self.sub3_5_button_1.grid(row=6, column=0, sticky='W', padx=30, pady=10)
692-
693-
self.sub3_4_3_entry_1 = tk.Entry(self.sub3_5_1, font=("", 12)) # for report
694-
689+
# Export to the IP Address table
690+
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'))
691+
self.sub3_5_button_1.grid(row=6, column=0, sticky='W', padx=20, pady=5)
695692

696693
def click_action_sub(self, click_value, target_area_name):
697-
if click_value == 'self.sub3_5_button_1': # select Run
694+
if click_value == 'self.sub3_5_button_1': # select IP address table
698695
###export_ip_report
699696
ns_extensions.ip_report.export_ip_report(self, target_area_name)
700697
ns_def.messagebox_file_open(str(self.outFileTxt_11_3.get()))
701698

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

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

749745
if click_value == 'self.self.sub2_6_button_2': # Click "VPNs on L3"
750-
print('--- Click VPNs on L3 ---')
746+
#print('--- Click VPNs on L3 ---')
751747
self.click_value = 'L3-4-1'
752748
self.click_value_VPN = 'VPN-1-3'
753749

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

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

952948
### open master panel

network_sketcher_dev.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ def __init__(self):
480480

481481
def click_action(self,click_value):
482482
self.click_value_l3 = ''
483+
self.flag_second_page = False # Add at Ver 2.3.4
483484

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

787-
# import module
788+
# create l1 diagram
788789
import ns_l1_diagram_create
789790
ns_l1_diagram_create.ns_l1_diagram_create.__init__(self)
790791

792+
self.flag_second_page = True # Add at Ver 2.3.4
793+
794+
# create l1 summary_diagram, Add at Ver 2.3.4
795+
if self.click_value == '2-4-3':
796+
import ns_extensions
797+
ns_extensions.summary_diagram.export_summary_diagram(self,'Dummy')
798+
799+
ns_l1_diagram_create.ns_l1_diagram_create.__init__(self)
800+
801+
# remove exist ppt file
802+
if os.path.isfile(self.excel_maseter_file_backup) == True:
803+
os.remove(self.excel_maseter_file_backup)
804+
805+
self.flag_second_page = False # Add at Ver 2.3.4
806+
791807
# view complete
792808
if self.click_value == '2-4-3': #Add at Ver 2.3.1(a)
793809
ns_def.messagebox_file_open(self.output_ppt_file)
@@ -1009,8 +1025,6 @@ def click_action(self,click_value):
10091025
ns_l2_table_from_master.ns_l2_table_from_master_l2_sheet.__init__(self)
10101026

10111027
input_excel_master_data.close()
1012-
# view complete
1013-
#tkinter.messagebox.showinfo('info', 'successfully completed')
10141028

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

1049-
# view complete
1050-
#tkinter.messagebox.showinfo('info', 'successfully completed')
1051-
10521063
if click_value == 'L2-3-1': # select browse
10531064
fTyp = [("", ".xlsx")]
10541065
iDir = os.path.abspath(os.path.dirname(sys.argv[0]))
@@ -1096,7 +1107,6 @@ def click_action(self,click_value):
10961107
# view complete
10971108
ns_def.messagebox_file_open(self.output_ppt_file)
10981109

1099-
11001110
if click_value == 'L3-1-1': # select browse
11011111
fTyp = [("", ".xlsx")]
11021112
iDir = os.path.abspath(os.path.dirname(sys.argv[0]))
@@ -1153,9 +1163,6 @@ def click_action(self,click_value):
11531163
iDir = os.path.abspath(os.path.dirname(sys.argv[0]))
11541164
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'
11551165

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

11801187
if click_value == 'L3-3-2' or click_value == 'L3-3-3': # select create from master
1181-
### TEST MODE ###
1182-
#self.inFileTxt_L3_3_1.delete(0, tkinter.END)
1183-
#self.inFileTxt_L3_3_1.insert(tk.END, 'C:/work/Network Sketcher/Network Skecher Ver2.0/[MASTER]Sample figure5.xlsx')
1184-
#################
1185-
11861188
full_filepath = self.inFileTxt_L3_3_1.get()
11871189
iDir = os.path.dirname(full_filepath)
11881190
basename_without_ext = os.path.splitext(os.path.basename(full_filepath))[0]

ns_ddx_figure.py

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,22 @@ def __init__(self):
5050
else:
5151
self.active_ppt = Presentation()
5252

53-
# width inches of slide master
54-
if (self.root_width + self.root_left * 2) < ppt_min_width:
55-
self.active_ppt.slide_width = Inches(ppt_min_width)
56-
elif (self.root_width + self.root_left * 2) > ppt_max_width:
57-
self.active_ppt.slide_width = Inches(ppt_max_width)
58-
else:
59-
self.active_ppt.slide_width = Inches(self.root_width + self.root_left * 2)
53+
if self.flag_second_page == False:
54+
# width inches of slide master
55+
if (self.root_width + self.root_left * 2) < ppt_min_width:
56+
self.active_ppt.slide_width = Inches(ppt_min_width)
57+
elif (self.root_width + self.root_left * 2) > ppt_max_width:
58+
self.active_ppt.slide_width = Inches(ppt_max_width)
59+
else:
60+
self.active_ppt.slide_width = Inches(self.root_width + self.root_left * 2)
6061

61-
# height inches of slide master
62-
if (self.root_hight + self.root_top * 1.5) < ppt_min_hight:
63-
self.active_ppt.slide_height = Inches(ppt_min_hight)
64-
elif (self.root_hight + self.root_top * 1.5) > ppt_max_hight:
65-
self.active_ppt.slide_height = Inches(ppt_max_hight)
66-
else:
67-
self.active_ppt.slide_height = Inches(self.root_hight + self.root_top * 1.5)
62+
# height inches of slide master
63+
if (self.root_hight + self.root_top * 1.5) < ppt_min_hight:
64+
self.active_ppt.slide_height = Inches(ppt_min_hight)
65+
elif (self.root_hight + self.root_top * 1.5) > ppt_max_hight:
66+
self.active_ppt.slide_height = Inches(ppt_max_hight)
67+
else:
68+
self.active_ppt.slide_height = Inches(self.root_hight + self.root_top * 1.5)
6869

6970
self.input_ppt_mata_excel = openpyxl.load_workbook(ppt_meta_file)
7071

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

284+
### change folder coler when create summary diagram at ver 2.3.4
285+
if self.flag_second_page == True and self.click_value == '2-4-3':
286+
shape_fill = self.shape.fill
287+
shape_fill.solid()
288+
shape_fill.fore_color.rgb = RGBColor(254, 246, 240)
289+
shape_line.color.rgb = RGBColor(251, 201, 159)
290+
shape_line.width = Pt(2.0)
291+
self.shape.adjustments[0] = 0.3
292+
self.shape.text_frame.paragraphs[0].font.size = Pt(16)
293+
294+
295+
296+
283297
'''change stlye from meta file'''
284298
temp_style_row = 1
285299
temp_style_flag = False
@@ -362,6 +376,11 @@ def add_sub_folder(self):
362376

363377
temp_style_row += 1
364378

379+
### change folder coler when create summary diagram at ver 2.3.4
380+
if self.flag_second_page == True and self.click_value == '2-4-3':
381+
self.shape.text_frame.paragraphs[0].font.size = Pt(16)
382+
self.shape.text_frame.vertical_anchor = MSO_ANCHOR.MIDDLE
383+
365384
'''run add shapes in own sub folder'''
366385
self.ddx_meta_row_folder = temp_row_folder
367386
self.ddx_meta_col_folder = temp_col_folder + 2
@@ -527,7 +546,7 @@ def add_shape(self):
527546
self.shape.shadow.inherit = False # disalbe dealut shadow effect
528547

529548
### change style for _AIR_ shape###
530-
if '_AIR_' in temp_shape_text:
549+
if '_AIR_' in temp_shape_text:
531550
shape_line.color.rgb = RGBColor(255, 255, 255)
532551
self.shape.text_frame.paragraphs[0].font.color.rgb = RGBColor(255, 255, 255)
533552

0 commit comments

Comments
 (0)