Skip to content

Commit

Permalink
Windows
Browse files Browse the repository at this point in the history
Correction mauvaise vue sur windows
  • Loading branch information
Axel927 committed Sep 17, 2022
1 parent ad4e839 commit f3dc13b
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 132 deletions.
Binary file modified additional/init_data_avec_accents.docx
Binary file not shown.
165 changes: 70 additions & 95 deletions src/data/init.py

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions src/ui/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
from time import time
from platform import system

if system() == 'Windows':
COEF = -1
else:
COEF = 1


class Board:
"""
Expand Down Expand Up @@ -364,6 +359,6 @@ def _offset(self):
Slot pour deplacer le robot selon la valeur de l'offset
:return: None
"""
self.board.translate(0, 0, (self.offset_sb.value() - self.board.get_offset()) * COEF)
self.board.translate(0, 0, (self.offset_sb.value() - self.board.get_offset()))
self.board.set_offset(self.offset_sb.value())
self.save_data.set_board('offset', self.board.get_offset())
14 changes: 3 additions & 11 deletions src/ui/mainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
from src import widget
from src import simulation

if system() == 'Windows':
# Coefficient de correction pour l'affichage sur Windows
COEF = -1
else:
COEF = 1


class MainWindow(QtWidgets.QMainWindow):
"""
Expand Down Expand Up @@ -390,7 +384,7 @@ def create_coord_sys(self):
self.viewer.addItem(self.z_coord_sys)

self.y_coord_sys.rotate(90, 0, 0, 1)
self.z_coord_sys.rotate(-90 * COEF, 0, 1, 0)
self.z_coord_sys.rotate(-90, 0, 1, 0)

def new_project(self):
"""
Expand Down Expand Up @@ -533,7 +527,7 @@ def new_main_robot(self, message=True, file=""):
self.viewer.addItem(self.main_robot)
self.list_widget.add_content(self.main_robot)
self.main_robot.set_offset(-self.main_robot.get_min_max()[2][0])
self.main_robot.translate(0, 0, self.main_robot.get_offset() * COEF)
self.main_robot.translate(0, 0, self.main_robot.get_offset())
self.save_data.set_main_robot('offset', self.main_robot.get_offset())
self.main_robot.setColor(self.init_data.get_main_robot('color'))
self.main_robot.set_edge_color(self.init_data.get_main_robot('edge_color'))
Expand Down Expand Up @@ -583,7 +577,7 @@ def new_second_robot(self, message=True, file=""):
self.viewer.addItem(self.second_robot)
self.list_widget.add_content(self.second_robot)
self.second_robot.set_offset(-self.second_robot.get_min_max()[2][0])
self.second_robot.translate(0, 0, self.second_robot.get_offset() * COEF)
self.second_robot.translate(0, 0, self.second_robot.get_offset())
self.save_data.set_second_robot('offset', self.second_robot.get_offset())
self.second_robot.setColor(self.init_data.get_second_robot('color'))
self.second_robot.set_edge_color(self.init_data.get_second_robot('edge_color'))
Expand Down Expand Up @@ -1084,8 +1078,6 @@ def start_view(self):
self.viewer.setCameraPosition(rotation=self.init_data.get_view('start_view_position_rotation'),
distance=self.init_data.get_view('start_view_position_distance'),
pos=self.init_data.get_view('start_view_position_pos'))
if system() == 'Windows':
self.viewer.setCameraPosition(elevation=-45)

self.viewer.pan(*(self.viewer.get_view_position() * -1), 0, relative='view-upright')

Expand Down
7 changes: 1 addition & 6 deletions src/ui/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
from src import widget
from src import element

if system() == 'Windows':
COEF = -1
else:
COEF = 1


class Robot:
"""
Expand Down Expand Up @@ -674,7 +669,7 @@ def _offset(self):
Slot pour deplacer le robot selon la valeur de l'offset
:return: None
"""
self.robot.translate(0, 0, (self.offset_sb.value() - self.robot.get_offset()) * COEF)
self.robot.translate(0, 0, (self.offset_sb.value() - self.robot.get_offset()))
self.robot.set_offset(self.offset_sb.value())
if self.robot.is_main_robot():
self.save_data.set_main_robot('offset', self.robot.get_offset())
Expand Down
23 changes: 9 additions & 14 deletions src/widget/viewWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@

from src import widget

if system() == 'Windows':
COEF = -1
else:
COEF = 1


class ViewWidget(gl.GLViewWidget):
"""
Expand Down Expand Up @@ -134,30 +129,30 @@ def mouseMoveEvent(self, ev):
if ev.buttons() == self.init_data.get_view('rotation_view_key'):
if ev.modifiers() & self.init_data.get_view('moving_view1'):
if self.panable():
self.pan(diff.x(), diff.y() * COEF, 0, relative='view') # Deplace la vue
self.pan(diff.x(), diff.y(), 0, relative='view') # Deplace la vue
self.view_position[0] += diff.x()
self.view_position[1] += diff.y() * COEF
self.view_position[1] += diff.y()
else:
self.setCursor(self.init_data.get_view('orbit_cursor'))
self.orbit(-diff.x(), diff.y() * COEF) # Tourne la vue
self.orbit(-diff.x(), diff.y()) # Tourne la vue

elif ev.buttons() == self.init_data.get_view('moving_view_middle_button'):
if ev.modifiers() & self.init_data.get_view('moving_view_middle_button1'):
if self.panable():
self.pan(diff.x(), 0, diff.y() * COEF, relative='view-upright')
self.pan(diff.x(), 0, diff.y(), relative='view-upright')
self.view_position[0] += diff.x()
self.view_position[1] += diff.y() * COEF
self.view_position[1] += diff.y()
else:
if self.panable():
self.pan(diff.x(), diff.y() * COEF, 0, relative='view-upright')
self.pan(diff.x(), diff.y(), 0, relative='view-upright')
self.view_position[0] += diff.x()
self.view_position[1] += diff.y() * COEF
self.view_position[1] += diff.y()

elif ev.buttons() == self.init_data.get_view('moving_view2'):
if self.panable():
self.pan(diff.x(), diff.y() * COEF, 0, relative='view')
self.pan(diff.x(), diff.y(), 0, relative='view')
self.view_position[0] += diff.x()
self.view_position[1] += diff.y() * COEF
self.view_position[1] += diff.y()

def keyPressEvent(self, event: QtGui.QKeyEvent) -> None:
"""
Expand Down

0 comments on commit f3dc13b

Please sign in to comment.