diff options
author | sara <sara.halter@gmx.ch> | 2021-11-11 20:05:40 +0100 |
---|---|---|
committer | sara <sara.halter@gmx.ch> | 2021-11-11 20:05:40 +0100 |
commit | 1e873c7ec474b1af4082aafcd33c0ba7a9fd3d51 (patch) | |
tree | 98e592e42f27ec2a6bd1db689fc1b4196b4c7573 /src | |
parent | FIR/Fading implementiert (diff) | |
parent | Create ZMQ test (diff) | |
download | Fading-1e873c7ec474b1af4082aafcd33c0ba7a9fd3d51.tar.gz Fading-1e873c7ec474b1af4082aafcd33c0ba7a9fd3d51.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src')
-rw-r--r-- | src/Test_Plots/test.py | 57 | ||||
-rw-r--r-- | src/Test_Plots/test10.py | 53 | ||||
-rw-r--r-- | src/Test_Plots/test1_updating_series_data.py | 30 | ||||
-rw-r--r-- | src/Test_Plots/test2_axis_limis.py | 40 | ||||
-rw-r--r-- | src/Test_Plots/test3_custom_axis_labels.py | 34 | ||||
-rw-r--r-- | src/Test_Plots/test4_multiple_y_axes.py | 25 | ||||
-rw-r--r-- | src/Test_Plots/test5_annotations.py | 32 | ||||
-rw-r--r-- | src/Test_Plots/test6_drag_points_and_lines.py | 26 | ||||
-rw-r--r-- | src/Test_Plots/test7_querying.py | 37 | ||||
-rw-r--r-- | src/Test_Plots/test8_custom_context_menus.py | 33 | ||||
-rw-r--r-- | src/Test_Plots/test9_colors_and_styles.py | 50 | ||||
-rwxr-xr-x | src/gui.py (renamed from src/sketch.py) | 52 | ||||
l--------- | src/qam.py | 1 |
13 files changed, 32 insertions, 438 deletions
diff --git a/src/Test_Plots/test.py b/src/Test_Plots/test.py deleted file mode 100644 index 3fb0d51..0000000 --- a/src/Test_Plots/test.py +++ /dev/null @@ -1,57 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -import qpks as qp - -q = qp.qpsk_nogui() - -dpg.create_context() - -# data = q.analog_random_source_x_0 - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) -sindatay2 = [] -for i in range(0, 100): - sindatay2.append(2 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=500, height=400): - # create a theme for the plot - with dpg.theme(tag="plot_theme"): - with dpg.theme_component(dpg.mvStemSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots) - - with dpg.theme_component(dpg.mvScatterSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots) - - # create plot - with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1): - - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") - - # series belong to a y axis - # dpg.add_stem_series(data, sindatay, label="Source", parent="yaxis", tag="series_data") - dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data") - dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2") - - # apply theme to series - dpg.bind_item_theme("series_data", "plot_theme") - dpg.bind_item_theme("series_data2", "plot_theme") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context()
\ No newline at end of file diff --git a/src/Test_Plots/test10.py b/src/Test_Plots/test10.py deleted file mode 100644 index d478d9a..0000000 --- a/src/Test_Plots/test10.py +++ /dev/null @@ -1,53 +0,0 @@ -from dearpygui.core import * -from dearpygui.simple import * -from math import cos - -def plot_callback(sender, data): - # keeping track of frames - frame_count = get_data("frame_count") - frame_count += 1 - add_data("frame_count", frame_count) - - # updating plot data - plot_datax = get_data("plot_datax") - plot_datay = get_data("plot_datay") - if len(plot_datax) > 2000: - frame_count = 0 - plot_datax.clear() - plot_datay.clear() - plot_datax.append(3.14 * frame_count / 180) - plot_datay.append(cos(3 * 3.14 * frame_count / 180)) - add_data("plot_datax", plot_datax) - add_data("plot_datay", plot_datay) - - # plotting new data - add_line_series("Plot", "Cos", plot_datax, plot_datay, weight=2) - -with window("Tutorial", width=500, height=500): - add_plot("Plot", height=-1) - add_data("plot_datax", []) - add_data("plot_datay", []) - add_data("frame_count", 0) - add_input_text("freq") - with menu_bar("Main Menu Bar"): - with menu("File"): - add_menu_item("test") - set_render_callback(plot_callback) - -with window("Heat", width=500, height=500): - add_plot("HeatPlot", show_color_scale=False, scale_min=0.0, scale_max=6.0, - scale_height=400, no_legend=True, - no_mouse_pos=True, xaxis_lock_min=True, xaxis_lock_max=True, xaxis_no_gridlines=True, xaxis_no_tick_marks=True, - yaxis_no_gridlines=True, yaxis_no_tick_marks=True, yaxis_lock_min=True, yaxis_lock_max=True, height=400) - set_color_map("HeatPlot", 6) - values = [0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0, - 2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0, - 1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0, - 0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0, - 0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0, - 1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1, - 0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3] - add_heat_series("HeatPlot", "heat data", values, 7, 7, 0, 6, format='') - - -start_dearpygui()
\ No newline at end of file diff --git a/src/Test_Plots/test1_updating_series_data.py b/src/Test_Plots/test1_updating_series_data.py deleted file mode 100644 index 1371008..0000000 --- a/src/Test_Plots/test1_updating_series_data.py +++ /dev/null @@ -1,30 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -# creating data -sindatax = [] -sindatay = [] -for i in range(0, 500): - sindatax.append(i / 1000) - sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) - -with dpg.window(label="Tutorial"): - # create plot - with dpg.plot(label="Line Series", height=400, width=400): - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis") - - # series belong to a y axis - dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context()
\ No newline at end of file diff --git a/src/Test_Plots/test2_axis_limis.py b/src/Test_Plots/test2_axis_limis.py deleted file mode 100644 index bdfeda1..0000000 --- a/src/Test_Plots/test2_axis_limis.py +++ /dev/null @@ -1,40 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin, cos - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 500): - sindatax.append(i / 1000) - sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) - -def update_series(): - - cosdatax = [] - cosdatay = [] - for i in range(0, 500): - cosdatax.append(i / 1000) - cosdatay.append(0.5 + 0.5 * cos(50 * i / 1000)) - dpg.set_value('series_tag', [cosdatax, cosdatay]) - dpg.set_item_label('series_tag', "0.5 + 0.5 * cos(x)") - -with dpg.window(label="Tutorial", tag="win"): - dpg.add_button(label="Update Series", callback=update_series) - # create plot - with dpg.plot(label="Line Series", height=400, width=400): - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis") - - # series belong to a y axis - dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis", tag="series_tag") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/Test_Plots/test3_custom_axis_labels.py b/src/Test_Plots/test3_custom_axis_labels.py deleted file mode 100644 index be6b80b..0000000 --- a/src/Test_Plots/test3_custom_axis_labels.py +++ /dev/null @@ -1,34 +0,0 @@ -import dearpygui.dearpygui as dpg - -dpg.create_context() - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.group(horizontal=True): - dpg.add_button(label="fit y", callback=lambda: dpg.fit_axis_data("y_axis")) - dpg.add_button(label="unlock x limits", callback=lambda: dpg.set_axis_limits_auto("x_axis")) - dpg.add_button(label="unlock y limits", callback=lambda: dpg.set_axis_limits_auto("y_axis")) - dpg.add_button(label="print limits x", callback=lambda: print(dpg.get_axis_limits("x_axis"))) - dpg.add_button(label="print limits y", callback=lambda: print(dpg.get_axis_limits("y_axis"))) - - with dpg.plot(label="Bar Series", height=-1, width=-1): - dpg.add_plot_legend() - - # create x axis - dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True, tag="x_axis") - dpg.set_axis_limits(dpg.last_item(), 9, 33) - dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31))) - - # create y axis - dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="y_axis") - dpg.set_axis_limits("y_axis", 0, 110) - - # add series to y axis - dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="y_axis") - dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="y_axis") - dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="y_axis") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context()
\ No newline at end of file diff --git a/src/Test_Plots/test4_multiple_y_axes.py b/src/Test_Plots/test4_multiple_y_axes.py deleted file mode 100644 index ebaac7e..0000000 --- a/src/Test_Plots/test4_multiple_y_axes.py +++ /dev/null @@ -1,25 +0,0 @@ -import dearpygui.dearpygui as dpg - -dpg.create_context() - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.plot(label="Bar Series", height=-1, width=-1): - dpg.add_plot_legend() - - # create x axis - dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True) - dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31))) - - # create y axis - dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="yaxis_tag") - - # add series to y axis - dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="yaxis_tag") - dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="yaxis_tag") - dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="yaxis_tag") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context()
\ No newline at end of file diff --git a/src/Test_Plots/test5_annotations.py b/src/Test_Plots/test5_annotations.py deleted file mode 100644 index 9deff6b..0000000 --- a/src/Test_Plots/test5_annotations.py +++ /dev/null @@ -1,32 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.plot(label="Annotations", height=-1, width=-1): - dpg.add_plot_legend() - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y") - dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent=dpg.last_item()) - - # annotations belong to the plot NOT axis - dpg.add_plot_annotation(label="BL", default_value=(0.25, 0.25), offset=(-15, 15), color=[255, 255, 0, 255]) - dpg.add_plot_annotation(label="BR", default_value=(0.75, 0.25), offset=(15, 15), color=[255, 255, 0, 255]) - dpg.add_plot_annotation(label="TR not clampled", default_value=(0.75, 0.75), offset=(-15, -15), - color=[255, 255, 0, 255], clamped=False) - dpg.add_plot_annotation(label="TL", default_value=(0.25, 0.75), offset=(-15, -15), color=[255, 255, 0, 255]) - dpg.add_plot_annotation(label="Center", default_value=(0.5, 0.5), color=[255, 255, 0, 255]) - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/Test_Plots/test6_drag_points_and_lines.py b/src/Test_Plots/test6_drag_points_and_lines.py deleted file mode 100644 index c6d8862..0000000 --- a/src/Test_Plots/test6_drag_points_and_lines.py +++ /dev/null @@ -1,26 +0,0 @@ -import dearpygui.dearpygui as dpg - -dpg.create_context() - -def print_val(sender): - print(dpg.get_value(sender)) - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.plot(label="Drag Lines/Points", height=-1, width=-1): - dpg.add_plot_legend() - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.set_axis_limits(dpg.last_item(), -5, 5) - dpg.add_plot_axis(dpg.mvYAxis, label="y") - dpg.set_axis_limits(dpg.last_item(), -5, 5) - - # drag lines/points belong to the plot NOT axis - dpg.add_drag_line(label="dline1", color=[255, 0, 0, 255], default_value=2.0, callback=print_val) - dpg.add_drag_line(label="dline2", color=[255, 255, 0, 255], vertical=False, default_value=-2, callback=print_val) - dpg.add_drag_point(label="dpoint1", color=[255, 0, 255, 255], default_value=(1.0, 1.0), callback=print_val) - dpg.add_drag_point(label="dpoint2", color=[255, 0, 255, 255], default_value=(-1.0, 1.0), callback=print_val) - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context()
\ No newline at end of file diff --git a/src/Test_Plots/test7_querying.py b/src/Test_Plots/test7_querying.py deleted file mode 100644 index 06f3ceb..0000000 --- a/src/Test_Plots/test7_querying.py +++ /dev/null @@ -1,37 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=400, height=600): - dpg.add_text("Click and drag the middle mouse button over the top plot!") - - - def query(sender, app_data, user_data): - dpg.set_axis_limits("xaxis_tag2", app_data[0], app_data[1]) - dpg.set_axis_limits("yaxis_tag2", app_data[2], app_data[3]) - - - # plot 1 - with dpg.plot(no_title=True, height=200, callback=query, query=True, no_menus=True, width=-1): - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y") - dpg.add_line_series(sindatax, sindatay, parent=dpg.last_item()) - - # plot 2 - with dpg.plot(no_title=True, height=200, no_menus=True, width=-1): - dpg.add_plot_axis(dpg.mvXAxis, label="x1", tag="xaxis_tag2") - dpg.add_plot_axis(dpg.mvYAxis, label="y1", tag="yaxis_tag2") - dpg.add_line_series(sindatax, sindatay, parent="yaxis_tag2") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context()
\ No newline at end of file diff --git a/src/Test_Plots/test8_custom_context_menus.py b/src/Test_Plots/test8_custom_context_menus.py deleted file mode 100644 index b459d15..0000000 --- a/src/Test_Plots/test8_custom_context_menus.py +++ /dev/null @@ -1,33 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=400, height=400): - # create plot - dpg.add_text("Right click a series in the legend!") - with dpg.plot(label="Line Series", height=-1, width=-1): - dpg.add_plot_legend() - - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") - - # series 1 - dpg.add_line_series(sindatax, sindatay, label="series 1", parent="yaxis", tag="series_1") - dpg.add_button(label="Delete Series 1", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_1")) - - # series 2 - dpg.add_line_series(sindatax, sindatay, label="series 2", parent="yaxis", tag="series_2") - dpg.add_button(label="Delete Series 2", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_2")) - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/Test_Plots/test9_colors_and_styles.py b/src/Test_Plots/test9_colors_and_styles.py deleted file mode 100644 index 2f1c7ef..0000000 --- a/src/Test_Plots/test9_colors_and_styles.py +++ /dev/null @@ -1,50 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) -sindatay2 = [] -for i in range(0, 100): - sindatay2.append(2 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=500, height=400): - # create a theme for the plot - with dpg.theme(tag="plot_theme"): - with dpg.theme_component(dpg.mvStemSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots) - - with dpg.theme_component(dpg.mvScatterSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots) - - # create plot - with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1): - - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") - - # series belong to a y axis - dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data") - dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2") - - # apply theme to series - dpg.bind_item_theme("series_data", "plot_theme") - dpg.bind_item_theme("series_data2", "plot_theme") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/sketch.py b/src/gui.py index 5f170b2..58e36a3 100755 --- a/src/sketch.py +++ b/src/gui.py @@ -36,7 +36,7 @@ create_viewport() setup_dearpygui() # Show demo for dev -# show_demo() +show_demo() #================================================ # Custom GNURadio blocks @@ -122,25 +122,40 @@ sim.connect((sim.digital_costas_loop_cc_0, 0), (locked_time_plot, 0)) # Settings Window with window(label="Settings", width=200, height=400, pos=(25, 450), tag="sim_win"): - add_button(label="Toggle Fullscreen", callback= toggle_viewport_fullscreen) + with child_window(autosize_x=True, height=100): + add_button(label="Toggle Fullscreen", callback= toggle_viewport_fullscreen) - add_text("Simulation running:") - add_text("false", tag="sim_running_lbl") + with child_window(autosize_x=True): + with group(horizontal=True): + add_text("Simulation running:") + add_text("false", tag="sim_running_lbl") - with group(horizontal=True): - def on_sim_start_btn_clicked(): - sim.start() - sim_runnig = True - logger.debug("Started simulation") + with group(tag="sim_grp", horizontal=True): + def on_sim_start_btn_clicked(): + global sim_running - def on_sim_stop_btn_clicked(): - sim.stop() - sim.wait() - sim_running = False - logger.debug("Stopped simulation") + if sim_running: + logger.error("Simulation is already running") + return - add_button(label="Start", tag="sim_start_btn", callback=on_sim_start_btn_clicked) - add_button(label="Stop", tag="sim_stop_btn", callback=on_sim_stop_btn_clicked) + sim.start() + sim_running = True + logger.debug("Started simulation") + + def on_sim_stop_btn_clicked(): + global sim_running + + if not sim_running: + logger.error("Simulation not running") + return + + sim.stop() + sim.wait() + sim_running = False + logger.debug("Stopped simulation") + + add_button(label="Start", tag="sim_start_btn", callback=on_sim_start_btn_clicked) + add_button(label="Stop", tag="sim_stop_btn", callback=on_sim_stop_btn_clicked) #================================================ # Flow Graph Window @@ -196,8 +211,3 @@ start_dearpygui() # clean up gui destroy_context() - -# Stop GNURadio -if sim_running: - sim.stop() - sim.wait() diff --git a/src/qam.py b/src/qam.py new file mode 120000 index 0000000..a59366b --- /dev/null +++ b/src/qam.py @@ -0,0 +1 @@ +../simulation/QAM/qam_nogui.py
\ No newline at end of file |