Skip to content

Commit

Permalink
added dx and dy to arbitrary linecut
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubenknex committed Oct 2, 2018
1 parent d457bfa commit 1745ac1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 4 additions & 1 deletion qtplot/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ def draw_arbitrary_linecut(self, x, y, initial_press):
# Display slope and inverse slope in status bar
dx = x - x_start
dy = y - y_start
text = 'Slope: {:.3e}\tInv: {:.3e}'.format(dy / dx, dx / dy)
text = 'dx = {}\tdy = {}\tdy/dx = {}\tdx/dy = {}'.format(eng_format(dx, 2),
eng_format(dy, 2),
eng_format(dy / dx, 2),
eng_format(dx / dy, 2))

self.parent.l_slope.setText(text)

Expand Down
11 changes: 11 additions & 0 deletions qtplot/linecut.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ def init_ui(self):
self.resize(700, 500)
self.move(630, 100)

# This flag is used to reposition the window next to the main window
# when drawing the first linecut
self.first_linecut = True
self.hide()

def populate_ui(self):
profile = self.main.profile_settings

Expand Down Expand Up @@ -361,11 +366,17 @@ def plot_linetrace(self, x, y, z, row_numbers, type, position, title,

self.fig.canvas.draw()

if self.isHidden():
self.show_window()

def resizeEvent(self, event):
self.fig.tight_layout()
self.canvas.draw()

def show_window(self):
if self.first_linecut:
self.move(630, 100)

self.show()
self.raise_()

Expand Down
4 changes: 2 additions & 2 deletions qtplot/qtplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ def init_ui(self):

self.setAcceptDrops(True)

self.linecut.show()
self.operations.show()
#self.linecut.show()
#self.operations.show()
self.show()

def update_ui(self, reset=True, opening_state=False):
Expand Down

0 comments on commit 1745ac1

Please sign in to comment.