Skip to content

Commit 8215ad0

Browse files
committed
Merge branch 'master' of https://github.com/mahilab/MEL
2 parents 7c5108e + 4d31a35 commit 8215ad0

File tree

5 files changed

+31
-117
lines changed

5 files changed

+31
-117
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ daq_logs/
2424
clock_logs/
2525
MELScope_v0.2.1/
2626
MELScope_v0.2.2/
27+
MELScope_v0.3.0/
2728

2829
#Python
2930
*.pyc

include/MEL/Mechatronics/Robot.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ class Robot : public Device {
7474
/// true if any exceeded, false otherwise
7575
bool any_limit_exceeded();
7676

77-
private:
77+
protected:
7878

7979
/// Virtual function to enable all robot joints.
80-
bool on_enable() final;
80+
bool on_enable();
8181

8282
/// Virtual function to disable all robot joints.
83-
bool on_disable() final;
83+
bool on_disable();
8484

8585
protected:
8686

src/MELScope/MelScope.pyw

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ import collections
2929
import qdarkstyle
3030
import ctypes
3131

32-
# TO DO:
33-
# turn scopes on off
34-
# thread melshare
35-
# save window size
36-
# curve scaling (eg deg2rad)
37-
# scope modules to generic modules, add interactive gain modules with sliders
38-
# open from .scope
39-
# changing colros when paused deletes data
40-
# add MelNet
41-
# write only shouldn't plot
42-
# write curves do weird things on plot -- should be hidden or fixed
43-
# settigns tab on each scope
44-
4532
#==============================================================================
4633
# DEFAULT SETTINGS
4734
#==============================================================================
@@ -96,7 +83,7 @@ time_mode = DEFAULT_TIME_MODE
9683
# GLOBAL CONSTANTS
9784
#==============================================================================
9885

99-
VER = '0.2.2'
86+
VER = '0.3.0'
10087

10188
SCREEN_RESOLUTION = application.desktop().screenGeometry()
10289
RESOLUTION_SCALE = SCREEN_RESOLUTION.width() / 1920.0
@@ -112,10 +99,10 @@ SCROLL_OPTIONS = ['Fixed', 'Rolling']
11299
NUM_SAMPLES = SAMPLE_DURATION * SAMPLE_TARGET
113100

114101
THEME_OPTIONS = ['Classic', 'Dark']
115-
THEME_STYLESHEETS = {'Classic': '', 'Dark': qdarkstyle.load_stylesheet(pyside=False)}
116-
THEME_SCOPE_BG_COLORS = {"Classic": [240, 240, 240], "Dark": [49, 54, 59]}
102+
THEME_STYLESHEETS = {'Classic': '', 'Dark': qdarkstyle.load_stylesheet_pyqt5()}
103+
THEME_SCOPE_BG_COLORS = {"Classic": [240, 240, 240], "Dark": [25, 35, 45]}
117104
THEME_SCOPE_FB_COLORS = {"Classic": [0, 0, 0], "Dark": [240, 240, 240]}
118-
THEME_SCOPE_VB_COLORS = {"Classic": [240, 240, 240], "Dark": [35, 38, 41]}
105+
THEME_SCOPE_VB_COLORS = {"Classic": [240, 240, 240], "Dark": [19, 27, 35]}
119106
THEME_SCOPE_IO_CONFIRMED_COLORS = {"Classic": [204, 232, 255], "Dark": [24, 70, 93]}
120107
THEME_SCOPE_IO_CHANGING_COLORS = {'Classic': [144, 200, 246], 'Dark': [191, 54, 12]}
121108

@@ -650,12 +637,11 @@ def open_new_instance():
650637
subprocess.Popen([sys.executable, 'MelScope.pyw'],
651638
creationflags=CREATE_NO_WINDOW)
652639

653-
def open():
640+
def open_scope():
654641
global filepath
655-
filepath = QtGui.QFileDialog.getOpenFileName(
656-
main_widget, 'Open MELScope', "", 'Scope Files (*.scope *.yaml)')
642+
filepath, _ = QtGui.QFileDialog.getOpenFileName(main_widget, 'Open MELScope', "", 'Scope Files (*.scope *.yaml)')
657643
if filepath:
658-
stream = file(filepath, 'r')
644+
stream = open(filepath, 'r')
659645
config = yaml.load(stream)
660646
remove_all_data_sources()
661647
remove_all_scope_modulels()
@@ -670,26 +656,26 @@ def open():
670656
main_window.setWindowTitle('MELScope (' + filename + ')')
671657

672658

673-
def save():
659+
def save_scope():
674660
global filepath
675661
if filepath:
676662
config = generate_config()
677-
stream = file(filepath, 'w')
663+
stream = open(filepath, 'w')
678664
yaml.dump(config, stream)
679665
filename = str(filepath[str(filepath).rfind('/') + 1:])
680666
filename = filename[0: filename.rfind('.')]
681667
status_bar.showMessage('Saved <' + filename + '>')
682668
main_window.setWindowTitle('MELScope (' + filename + ')')
683669
else:
684-
save_as()
670+
save_scope_as()
685671

686672

687-
def save_as():
673+
def save_scope_as():
688674
global filepath
689-
new_filepath = QtGui.QFileDialog.getSaveFileName(main_widget, 'Save MELScope', "", 'Scope Files (*.scope *.yaml)')
675+
new_filepath, _ = QtGui.QFileDialog.getSaveFileName(main_widget, 'Save MELScope', "", 'Scope Files (*.scope *.yaml)')
690676
if new_filepath:
691677
filepath = new_filepath
692-
save()
678+
save_scope()
693679

694680

695681
def deploy_config(config):
@@ -943,7 +929,7 @@ class ConfigureDataDialog(QtGui.QDialog):
943929
new_line_combo_box = QtGui.QComboBox(self)
944930
new_line_combo_box.addItems(CURVE_STYLE_OPTIONS.keys())
945931
new_line_combo_box.setCurrentIndex(
946-
CURVE_STYLE_OPTIONS.keys().index(data_sources[name].curve_styles[i]))
932+
list(CURVE_STYLE_OPTIONS.keys()).index(data_sources[name].curve_styles[i]))
947933
self.line_combo_boxes[name].append(new_line_combo_box)
948934
layout.addWidget(new_line_combo_box, row, 5)
949935

@@ -1271,7 +1257,7 @@ def about():
12711257
AboutDialog.open_dialog()
12721258

12731259
def open_github():
1274-
webbrowser.open('https://github.com/epezent/MEL')
1260+
webbrowser.open('https://github.com/mahilab/MEL')
12751261

12761262
def prompt_scroll_mode():
12771263
global time_mode
@@ -1324,15 +1310,15 @@ new_action = QtGui.QAction('&New', main_window,
13241310
file_menu.addAction(new_action)
13251311

13261312
open_action = QtGui.QAction('&Open...', main_window,
1327-
shortcut='Ctrl+O', statusTip='Open an existing MELScope', triggered=open)
1313+
shortcut='Ctrl+O', statusTip='Open an existing MELScope', triggered=open_scope)
13281314
file_menu.addAction(open_action)
13291315

13301316
save_action = QtGui.QAction('&Save', main_window,
1331-
shortcut='Ctrl+S', statusTip='Save this MELScope', triggered=save)
1317+
shortcut='Ctrl+S', statusTip='Save this MELScope', triggered=save_scope)
13321318
file_menu.addAction(save_action)
13331319

13341320
save_as_action = QtGui.QAction('Save &As...', main_window,
1335-
shortcut='Ctrl+Shift+S', statusTip='Save this MELScope under a new name', triggered=save_as)
1321+
shortcut='Ctrl+Shift+S', statusTip='Save this MELScope under a new name', triggered=save_scope_as)
13361322
file_menu.addAction(save_as_action)
13371323

13381324
reload_action = QtGui.QAction('&Reload', main_window,
@@ -1347,9 +1333,9 @@ add_melshare_action = QtGui.QAction('&Add MELShare...', main_window,
13471333
shortcut='Ctrl+A', statusTip='Add a MELShare data source', triggered=prompt_add_melshare)
13481334
edit_menu.addAction(add_melshare_action)
13491335

1350-
add_melnet_action = QtGui.QAction('Add &MELNet...', main_window,
1351-
shortcut='Ctrl+Shift+A', statusTip='Add a MELNet data source', triggered=prompt_add_melnet)
1352-
edit_menu.addAction(add_melnet_action)
1336+
# add_melnet_action = QtGui.QAction('Add &MELNet...', main_window,
1337+
# shortcut='Ctrl+Shift+A', statusTip='Add a MELNet data source', triggered=prompt_add_melnet)
1338+
# edit_menu.addAction(add_melnet_action)
13531339

13541340
remove_action = QtGui.QAction('&Remove Data Source...', main_window,
13551341
shortcut='Ctrl+X', statusTip='Remove an existing data source', triggered=prompt_remove_melshare)
@@ -1422,7 +1408,7 @@ status_bar.addPermanentWidget(rate_label)
14221408
for i in range (QtGui.QColorDialog.customCount()):
14231409
rgb = CURVE_COLOR_OPTIONS[i]
14241410
color = QtGui.QColor(rgb[0], rgb[1], rgb[2])
1425-
QtGui.QColorDialog.setCustomColor(i, color.rgb())
1411+
QtGui.QColorDialog.setCustomColor(i, color)
14261412

14271413
set_theme()
14281414
reload_grid()
@@ -1461,7 +1447,7 @@ render_loop_timer.start(1000 / FPS_TARGET)
14611447

14621448
# connect main window closeEvent to custom close to prevent crash
14631449
def close(event):
1464-
print "Closing MELScope"
1450+
# print("Closing MELScope")
14651451
sys.exit()
14661452
main_window.closeEvent = close
14671453

src/MELScope/Mutex.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
from ctypes import wintypes
1919

2020
# Create ctypes wrapper for Win32 functions we need, with correct argument/return types
21-
_CreateMutex = ctypes.windll.kernel32.CreateMutexA
22-
_CreateMutex.argtypes = [wintypes.LPCVOID, wintypes.BOOL, wintypes.LPCSTR]
21+
# python2 should use CreateMutexA w/ wintypes.LPCSTR
22+
_CreateMutex = ctypes.windll.kernel32.CreateMutexW
23+
_CreateMutex.argtypes = [wintypes.LPCVOID, wintypes.BOOL, wintypes.LPCWSTR]
2324
_CreateMutex.restype = wintypes.HANDLE
2425

2526
_WaitForSingleObject = ctypes.windll.kernel32.WaitForSingleObject
@@ -120,5 +121,5 @@ def __exit__(self, exc_type, exc_val, exc_tb):
120121
# b = Mutex("my_mutex")
121122

122123
# b.try_lock()
123-
# print "B can continue now"
124+
# print("B can continue now")
124125
# b.release()

src/MELScope/README.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)