ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
def minutes(self):
from decimal import Decimal, ROUND_UP
import os
import math
scale = unicode(self.comboBox7.currentText())
job = os.path.expanduser("~/hpgl-hot-folder/temp.plot")
thestat = os.stat(job)
size = thestat[6]
known = 1000
factor = self.LCDNumber5.value()
if scale==(self.__tr("3.53")):
cut = size / known * 40 / 272
self.LCDNumber17.display(round(cut, 2))
else:
cut = size / known * 6 / 257
self.LCDNumber17.display(round(cut, 2))
In the above all is working great except I'd like to have the "factor" variable adjust the LCDNumber17 display slightly. The slider values range from 1-60 units.I've done some tests and with slider on 30 it takes 40min. with the slider on 5 it takes 46min. I need to find a relationship for the slider valve and as the slider value increases the time (LCDNumber17) goes down correspondingly and put it at the end of the "cut" calculation.
In the above all is working great except I'd like to have the "factor" variable adjust the LCDNumber17 display slightly. The slider values range from 1-60 units.I've done some tests and with slider on 30 it takes 40min. with the slider on 5 it takes 46min. I need to find a relationship for the slider valve and as the slider value increases the time (LCDNumber17) goes down correspondingly and put it at the end of the "cut" calculation.
Sorry I don't understand you code. However, I think I understand that you want to define a function that relates "slider" (what ever that is) to time.
y=m*x + c
m = (46-40)/(5-30) = -6/25 = -0.24
c = 46-m*5 = 47.2
The main problem here is that I don't understand your code. You've posted one method from a class with a bunch of member objects and functions which are defined somewhere else. If you can cut your code down to something that can be understood on it's own I might be able to help.
All the calculations that are in the code post work very accurately but the slider value (variable "factor") with units 1-60 influence the time(derived from the "cut" variable) value specified by LCDNumber17 greatly. I did some actual time tests and with a known file size (size variable) with the slider value at 30 it took 40 minutes and the same file at slider value at 5 it took 46 minutes. I was hoping to establish a ratio based on slider units that could be added or multiplied to the
"cut = size / known * 40 / 272" calculation?
File size will vary always
I'm not sure if I'm going the right way to accomplish this or not?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.