text
stringlengths 1
93.6k
|
|---|
self.t = self.z
|
self.z = self.y
|
self.y = self.x
|
self.x = self.x
|
self.updateDisplays()
|
self.keip = False
|
self.needrup = False
|
def calculate(self, op):
|
"""Arithmetic calculations between x and y registers, then rotate down."""
|
try:
|
if op == '+/-':
|
self.x = self.x * -1
|
self.xdisplay.setText(str(self.x))
|
else:
|
if op == '+':
|
res = self.y + self.x
|
elif op == '-':
|
res = self.y - self.x
|
elif op == '*':
|
res = self.y * self.x
|
elif op == '/':
|
res = self.y / self.x
|
self.x = res
|
self.y = self.z
|
self.z = self.t
|
self.updateDisplays()
|
self.keip = False
|
self.needrup = True
|
except:
|
self.xdisplay.setText("ERROR")
|
def func(self, op, in_cnvrt=0, out_cnvrt=0):
|
"""Evaluate function op then put result in x-register, don't rotate stack.
|
if in_cnvrt: convert input value from degrees to radians.
|
if out_cnvrt: convert output value from radians to degrees."""
|
x = self.x
|
y = self.y
|
if in_cnvrt:
|
x = x * math.pi / 180
|
result = eval(op)
|
if out_cnvrt:
|
result = result * 180 / math.pi
|
self.x = result
|
self.xdisplay.setText(str(self.x))
|
self.keip = False
|
self.needrup = True
|
def mm2in(self):
|
if self.xdisplay.text():
|
self.x = self.x / 25.4
|
self.xdisplay.setText(str(self.x))
|
self.keip = False
|
self.needrup = True
|
def in2mm(self):
|
if self.xdisplay.text():
|
self.x = self.x * 25.4
|
self.xdisplay.setText(str(self.x))
|
self.keip = False
|
self.needrup = True
|
def storex(self):
|
self.mem = self.x
|
self.keip = False
|
self.needrup = True
|
def recallx(self):
|
self.rotateup()
|
self.xdisplay.setText(str(self.mem))
|
self.keip = False
|
self.needrup = True
|
def rotateup(self, loop=1):
|
x = self.t
|
self.t = self.z
|
self.z = self.y
|
self.y = self.x
|
if loop:
|
self.x = x
|
self.updateDisplays()
|
def rotatedn(self):
|
x = self.x
|
self.x = self.y
|
self.y = self.z
|
self.z = self.t
|
self.t = x
|
self.updateDisplays()
|
def trimx(self):
|
trimmedStrVal = self.xdisplay.text()[:-1]
|
try:
|
self.xdisplay.setText(trimmedStrVal)
|
self.x = float(trimmedStrVal)
|
except ValueError:
|
self.clearx()
|
def swapxy(self):
|
self.x, self.y = (self.y, self.x)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.