Skip to content

Commit

Permalink
[mapping panel] adjust canvas height and weight according to numbers …
Browse files Browse the repository at this point in the history
…of rows and cols
  • Loading branch information
yuqisun committed Aug 28, 2024
1 parent 6210398 commit 64a22e2
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions launchUI_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,9 @@ def clickTest():
print(outputLine)
if "%]" in outputLine:
value = int(outputLine.split("[")[1].split("%]")[0])
widgets["testProgress"].configure(value=value)
widgets["testShow"].configure(text=str(value) + "%", fg="red")
# print(f'testProgress value: {value}')
widgets["testProgress"].set(value/100)
widgets["testShow"].configure(text=str(value) + "%")
master.update_idletasks()
total += 1
if ".py F" in outputLine:
Expand Down Expand Up @@ -1405,8 +1406,12 @@ def drawSchedule():

canvas = widgets["mappingCanvas"]
canvas.delete("all")
ROWS = widgets["ROWS"]
COLS = widgets["COLS"]
GRID_WIDTH = (TILE_WIDTH + LINK_LENGTH) * COLS - LINK_LENGTH
GRID_HEIGHT = (TILE_HEIGHT + LINK_LENGTH) * ROWS - LINK_LENGTH
cgraWidth = GRID_WIDTH + MEM_WIDTH + LINK_LENGTH + 20
canvas.configure(scrollregion=(0, 0, mappingII * cgraWidth, GRID_HEIGHT))
canvas.configure(scrollregion=(0, 0, mappingII * cgraWidth, GRID_HEIGHT + 40 + BORDER))

for ii in range(mappingII):
# draw data memory
Expand Down Expand Up @@ -1452,7 +1457,7 @@ def drawSchedule():
# cycleLabel = tkinter.Label(canvas, text="Cycle " + str(ii))
cycleLabel = customtkinter.CTkLabel(canvas, text="Cycle " + str(ii) + " ",
font=customtkinter.CTkFont(size=FRAME_LABEL_LEVEL_2_FONT_SIZE, weight="bold", slant='italic'))
canvas.create_window(baseX + 280, GRID_HEIGHT + 10 + BORDER, window=cycleLabel, height=20, width=80)
canvas.create_window(baseX + (cgraWidth)/2, GRID_HEIGHT + 30 + BORDER, window=cycleLabel, height=20, width=80)

baseX += GRID_WIDTH + MEM_WIDTH + LINK_LENGTH + 20
canvas.create_line(baseX - 5, INTERVAL, baseX - 5, GRID_HEIGHT, width=2, dash=(10, 2), fill="grey")
Expand Down Expand Up @@ -1543,6 +1548,9 @@ def _on_mousewheel(canvas, event):
def create_cgra_pannel(master, rows, columns):
ROWS = rows
COLS = columns
widgets["ROWS"] = ROWS
widgets["COLS"] = COLS
print(f"create_cgra_pannel - ROWS: {ROWS}, COLS: {COLS}")
# master.grid_propagate(0)
# Use solid black board to let the pannel look better
cgraPannel = customtkinter.CTkFrame(master)
Expand Down Expand Up @@ -1992,7 +2000,7 @@ def create_test_pannel(master):
testButton.grid(row=1, column=0, ipadx=5)
# testProgress = ttk.Progressbar(testPannel, orient='horizontal', mode='determinate')
testProgress = customtkinter.CTkProgressBar(testPannel, orientation='horizontal', mode='determinate', width=160)
testProgress['value'] = 0
testProgress.set(0)
widgets["testProgress"] = testProgress
testProgress.grid(row=1, column=1, rowspan=1, columnspan=1, padx=5, sticky="ew")
testShow = customtkinter.CTkLabel(testPannel, text="IDLE ")
Expand Down

1 comment on commit 64a22e2

@yuqisun
Copy link
Collaborator Author

@yuqisun yuqisun commented on 64a22e2 Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mapping panel] adjust canvas height and weight according to numbers of rows and cols

6x6 example:
mapping panel  adjust canvas height and weight according to numbers of rows and cols

Please sign in to comment.