Skip to content

Instantly share code, notes, and snippets.

@SpyDude
Created November 4, 2011 14:30
Show Gist options
  • Save SpyDude/1339444 to your computer and use it in GitHub Desktop.
Save SpyDude/1339444 to your computer and use it in GitHub Desktop.
Troble with 3 and 4 math...
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import sys, pygtk
pygtk.require('2.0')
except:
print 'Не удалось импортировать модуль PyGTK'
sys.exit(1)
import gtk
import math
class Solver(object):
@staticmethod
def calctw1(tsw, condfactor):
tw1 = (tsw + condfactor)
return (tsw + condfactor)
@staticmethod
def calctk(tw1, tcondfactor):
tk = (tw1 + tcondfactor)
return (tw1 + tcondfactor)
@staticmethod
def calctlr(tk, tlroutcond):
tlr = (tk - tlroutcond)
return (tk - tlroutcond)
@staticmethod
def calctbrina(taincr, tbrinac):
tbrina = (taincr - tbrinac)
return (taincr - tbrinac)
@staticmethod
def calctrentrycompr(tbrina, trentrycompr):
trentrycompr = (tbrina + trentrycompr)
return (tbrina + trentrycompr)
class InitialData(object):
def on_window_destroy(self, widget, data=None):
gtk.main_quit()
def on_button1_clicked(self, widget, data=None):
tsw = float(self.entry_tsw.get_text())
taincr = float(self.entry_taincr.get_text())
tbrinac = self.entry_tbrinac.get_value()
condfactor = self.entry_condfactor.get_value()
tcondfactor = self.entry_tcondfactor.get_value()
tlroutcond = self.entry_tlroutcond.get_value()
trentrycompr = self.entry_trentrycompr.get_value()
tw1 = Solver.calctw1(tsw, condfactor)
text = "{0:g}".format(tw1)
self.rtcwec.set_markup(text)
tk = Solver.calctk(tw1, tcondfactor)
text = "{0:g}".format(tk)
self.rtcond.set_markup(text)
tlr = Solver.calctlr(tk, tlroutcond)
text="{0:g}".format(tlr)
self.rtlroutcond.set_markup(text)
tbrina = Solver.calctbrina(taincr, tbrinac)
text="{0:g}".format(tbrina)
self.rtbrina.set_markup(text)
trentrycompr = Solver.calctrentrycompr(tbrina, trentrycompr)
text="{0:g}".format(trentrycompr)
self.rtrentrycompr.set_markup(text)
def __init__(self):
builder = gtk.Builder()
builder.add_from_file("diplomnew.glade")
self.window = builder.get_object("window")
self.button1 = builder.get_object("button1")
self.entry_tsw = builder.get_object("entry_tsw")
self.entry_taincr = builder.get_object("entry_taincr")
self.entry_tlroutcond = builder.get_object("entry_tlroutcond")
self.entry_condfactor = builder.get_object("entry_condfactor")
self.entry_tcondfactor = builder.get_object("entry_tcondfactor")
self.entry_trentrycompr = builder.get_object("entry_trentrycompr")
self.entry_tbrinac = builder.get_object("entry_tbrinac")
self.rtlroutcond = builder.get_object("rtlroutcond")
self.rtcwec = builder.get_object("rtcwec")
self.rtcond = builder.get_object("rtcond")
self.rtbrina = builder.get_object("rtbrina")
self.rtrentrycompr = builder.get_object("rtrentrycompr")
builder.connect_signals(self)
if __name__ == "__main__":
calc = InitialData()
calc.window.show()
gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment