Skip to content

Commit ed64daa

Browse files
committed
in setup.py use version from ev3dev2simulator/version.py
added version [1.0.4] - 2020-02-28 ### Added - improved Options menu by adding label "Warning: to use the simulated bluetooth in the simulator make sure you have PyBluez uninstalled!!" - improved Options menu for windows we only have option "show simulator fullscreen on second screen" because on windows for none fullscreen mode the simulator is always opened on the default screen. - improved Options menu for macos where we only have two options "show simulator fullscreen" and "show simulator on second screen". Latter option is added because when dragging window to other screen sometimes messes up the resolution of the window. By drawing the window already at startup at the second screen prevents this problem. - improved Options menu by adding caption which explains the rpyc timeout you can configure under advanced options. ### Fixed - fixed cleanup of files on EV3 by switching to new ev3devcmd library
1 parent 8929742 commit ed64daa

4 files changed

Lines changed: 29 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.3.2] - 2020-02-28
11+
12+
### Added
13+
- added simulated bluetooth.py to ev3dev2simulator package.
14+
- Warning: to use the simulated bluetooth in the simulator make sure you have PyBluez uninstalled!!
15+
16+
### Fixed
17+
- fullscreen switch when dragged: drag window to screen where you want it fullscreen, and then press F
18+
- key T toggles fullscreen view between the two screens (if not at fullscreen, nothing happens)
19+
20+
1021
## [1.3.1] - 2020-02-07
1122

1223
### Added

ev3dev2simulator/Simulator.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
import arcade
1212
from pymunk import Space
1313

14-
# HACK: https://gamedev.stackexchange.com/questions/16024/secondary-monitor-freezes-game-window
15-
#from pyglet.gl import *
16-
1714
# HACK: need to change dir to Simulator script's directory because resources are loaded relative from this directory
1815
script_dir = os.path.dirname(os.path.realpath(__file__))
1916
os.chdir(script_dir)
@@ -109,6 +106,12 @@ def __init__(self, robot_state: RobotState, robot_pos: Tuple[int, int, int], sho
109106

110107
self.check_for_activation()
111108

109+
110+
def get_screens(self):
111+
display = pyglet.canvas.get_display()
112+
screens= display.get_screens()
113+
return screens
114+
112115
def set_screen_to_display_simulator_at_startup(self,use_second_screen_to_show_simulator):
113116
""" Set screen to use to display the simulator at startup. For windows this works only in fullscreen mode.
114117
@@ -123,8 +126,7 @@ def set_screen_to_display_simulator_at_startup(self,use_second_screen_to_show_si
123126
current_screen_index=0
124127
if use_second_screen_to_show_simulator == True:
125128
current_screen_index=1
126-
display = pyglet.canvas.get_display()
127-
screens= display.get_screens()
129+
screens= self.get_screens()
128130
for screen in screens: print(screen)
129131
num_screens=len(screens)
130132
if num_screens== 1:
@@ -138,6 +140,8 @@ def set_screen_to_display_simulator_at_startup(self,use_second_screen_to_show_si
138140
def get_default_screen():
139141
"""Get the default screen as specified by the user's operating system preferences."""
140142
return screens[self.current_screen_index]
143+
144+
display = pyglet.canvas.get_display()
141145
display.get_default_screen=get_default_screen
142146

143147
# note:
@@ -303,7 +307,7 @@ def on_key_press(self, key, modifiers):
303307
# Toggle fullscreen between screens (only works at fullscreen mode)
304308
if key == arcade.key.T:
305309
# User hits T. When at fullscreen, then switch screen used for fullscreen.
306-
if self.fullscreen:
310+
if self.fullscreen and len(self.get_screens()) > 1:
307311
# to switch screen when in fullscreen we first have to back to normal window, and do fullscreen again
308312
self.set_fullscreen(False)
309313
# switch which screen is used for fullscreen ; Toggle between first and second screen (other screens are ignored)
@@ -327,26 +331,21 @@ def on_key_press(self, key, modifiers):
327331
#toggle screen for fullscreen
328332
# BUG: doesn't work on macos => see explaination in set_screen_to_display_simulator_at_startup() method
329333
def toggleScreenUsedForFullscreen(self):
330-
display = pyglet.canvas.get_display()
331-
screens= display.get_screens()
332-
num_screens=len(screens)
333-
if num_screens== 1:
334-
return
334+
335335
# toggle only between screen 0 and 1 (other screens are ignored)
336336
self.current_screen_index=(self.current_screen_index+1)%2
337337

338338
# override hidden screen parameter in window
339+
screens= self.get_screens()
339340
self._screen=screens[self.current_screen_index]
340341

341342
def updateCurrentScreen(self):
342343
""" using the windows position and size we determine on which screen it is currently displayed and make that
343344
current screen for displaying in fullscreen!!
344345
"""
345346

346-
display = pyglet.canvas.get_display()
347-
screens= display.get_screens()
348-
num_screens=len(screens)
349-
if num_screens== 1:
347+
screens= self.get_screens()
348+
if len(screens)== 1:
350349
return
351350

352351
location=self.get_location()
@@ -430,12 +429,6 @@ def on_draw(self):
430429

431430
arcade.start_render()
432431

433-
# HACK: https://gamedev.stackexchange.com/questions/16024/secondary-monitor-freezes-game-window
434-
# glEnable(GL_BLEND)
435-
# glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
436-
# glEnable(GL_LINE_SMOOTH)
437-
# glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE)
438-
439432
self.obstacle_elements.draw()
440433
self.robot_elements.draw()
441434

ev3dev2simulator/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.3.1'
1+
__version__ = '1.3.2'

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import sys
44

55

6+
from ev3dev2simulator.version import __version__ as simversion
7+
68
setup(
79
name="ev3dev2simulator",
8-
version="1.3.1",
10+
version=simversion,
911
description="EV3 simulator for the ev3dev2 library",
1012
long_description="""
1113
Simulator for an EV3 robot; a program using the ev3dev2 API can run both on the rover and on the simulator without any modifications to the code.

0 commit comments

Comments
 (0)