Initial move from SVN
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# Compiled Python
|
||||
*.pyc
|
||||
|
||||
# SCons
|
||||
.sconf_temp
|
||||
.sconsign.dblite
|
||||
|
||||
# Build byproducts
|
||||
build
|
||||
config.log
|
||||
package.txt
|
||||
|
||||
# Temporary files
|
||||
*~
|
4
.gitmodules
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
[submodule "version"]
|
||||
path = version
|
||||
url = git@github.com:FoldingAtHome/client-version.git
|
||||
branch = master
|
155
CHANGELOG.md
Normal file
@ -0,0 +1,155 @@
|
||||
## v7.4.1
|
||||
- Removed trigger-save command, no longer necessary.
|
||||
|
||||
## v7.3.12
|
||||
- Reordered toolbar.
|
||||
- Move Viewer button to right of power bar. #304
|
||||
- Changed FAHControl title bar to say Advanced Control. #982
|
||||
- Right clicking on slot brings up correct slot menu. Mentioned in #1060
|
||||
- Removed Configure->Advanced->Optimizations. #1069
|
||||
|
||||
## v7.3.11
|
||||
- Split power slider to power + fold/pause/finish.
|
||||
- Added "on idle" & "always on" to slot menu.
|
||||
- Removed Percent CPU usage, not currently support by any cores. #1056
|
||||
|
||||
## v7.3.7
|
||||
- Restored ctrl-a and ctrl-c functionality in log view. #1002
|
||||
|
||||
## v7.3.6
|
||||
- UI layout adjustments.
|
||||
|
||||
## v7.3.5
|
||||
- Put Viewer button back on toolbar.
|
||||
- Added additional tooltips.
|
||||
|
||||
## v7.3.4
|
||||
- Trigger save on folding power change.
|
||||
- Fix folding power reset problem on options save.
|
||||
|
||||
## v7.3.3
|
||||
- Fixed OK/Cancel buttons off bottom of screen at some resolutions. #904
|
||||
- Don't show selected client status in add client dialog.
|
||||
- Added folding power slider.
|
||||
- Removed client Fold/Pause/Finish/View buttons, use slot popup menu.
|
||||
- The links for project, WS & CS can extend to the edge of the window. #977
|
||||
- Changed Quit to Exit.
|
||||
- Added --exit command line option.
|
||||
|
||||
## v7.3.2
|
||||
- Center About box text.
|
||||
|
||||
## v7.3.0
|
||||
- Updated copyright dates.
|
||||
- Restored 'Work Unit' pane to 'Status' tab.
|
||||
- Fixed Missing, hidden, and vanishing text in Ubuntu 12.04. #898
|
||||
- Remote system remains "Updating". #906
|
||||
|
||||
## v7.2.14
|
||||
- Removed local client startup functionality.
|
||||
- Flipped 'Folding Slots' / 'Queue' orientation. #951
|
||||
- Always list local client first. #655
|
||||
|
||||
## v7.2.13
|
||||
- Merged SMP and Uni slot types to CPU.
|
||||
- Removed novice/advanced/expert modes. #852
|
||||
- Removed project descriptions.
|
||||
- Enforce min GPU and CPU usage of 10%.
|
||||
- Removed all systray functionality. #217, #565, #487, #321
|
||||
- Disable search on tree views. #953
|
||||
- OSX: Don't quit app when window is closed. #606
|
||||
|
||||
## v7.2.12
|
||||
- Autostart client by default, if it's not already running.
|
||||
|
||||
## v7.2.11
|
||||
- Hide 'Folding Slot Status' column in expert/advanced.
|
||||
- Show status colors even when row is selected.
|
||||
|
||||
## v7.2.10
|
||||
- Fixed OSX: Copy/Paste not working. #588
|
||||
- Fixed OSX: Copy the log clears the log window. #601
|
||||
- Removed show project pane in advanced preference.
|
||||
- Moved WU info to a separate popup dialog.
|
||||
- Display Work Queue to right of Folding Slots in advanced/expert.
|
||||
- Changed 'Stats' and 'PPD' to 'Points Per Day'.
|
||||
- Hide PCRG Work Queue column in novice mode.
|
||||
- Don't show RCG in 'About Project' line.
|
||||
- Display slot status with reason in Work Queue. #743
|
||||
- Check if client is configured and popup dialog if not.
|
||||
|
||||
## v7.2.9
|
||||
- Fixed OSX: gtk 2 is broken on 10.7. #793
|
||||
|
||||
## v7.2.8
|
||||
- Pass remote passwords to viewer.
|
||||
|
||||
## v7.2.7
|
||||
- Updated view modes.
|
||||
|
||||
## v7.2.0
|
||||
- Fix " escaping for options sent to client.
|
||||
- Only allow alpha numeric and puntuation in user name.
|
||||
- Updates for OSX 10.7 (calxalot)
|
||||
|
||||
## v7.1.52
|
||||
- Select 'Identity' tab by default. #851
|
||||
|
||||
## v7.1.50
|
||||
- Z in the Zulu time display was still partially cut off. #839
|
||||
|
||||
## v7.1.49
|
||||
- Z in the Zulu time display was partially cut off. #839
|
||||
- Build Linux version on Debian testing for python 2.7 support. #763
|
||||
|
||||
## v7.1.48
|
||||
- Added some tooltips.
|
||||
- Fixed windows default theme.
|
||||
|
||||
## v7.1.47
|
||||
- Added UTC time to status bar. #647
|
||||
- Fixed missing system info. #834
|
||||
- Fixed false 'Inactive' systray message. #526
|
||||
- Display total PPD for all clients and all slots. #408
|
||||
- Removed Unit ID from Work Unit status.
|
||||
|
||||
## v7.1.46
|
||||
- Default local client autostart to false.
|
||||
- Integrated caxalot's OSX install script changes.
|
||||
- Fixed themes for Linux. #819
|
||||
- Hide theme prefernece in OSX, causes crashes in current gtk.
|
||||
- Really fix, Increment number of CPUs by 1 instead of 2. #804
|
||||
|
||||
## v7.1.45
|
||||
- Fixed OSX icons file. (calxalot)
|
||||
- Increment number of CPUs by 1 instead of 2. #804
|
||||
|
||||
## v7.1.44
|
||||
- Fixed floating buttons on log tab. #789
|
||||
- Changed 'Queue ID' -> 'Work Queue ID'. #790
|
||||
- Changed '1' -> '01' in folding slot id. #790
|
||||
|
||||
## v7.1.43
|
||||
- Don't flash 'Offline' status while trying to connect.
|
||||
- Cleaned up some Windows related connection issues.
|
||||
- Don't timeout connection because FAHControl is busy.
|
||||
- Updated copyright dates.
|
||||
- Restore 'Follow' log check box. #758
|
||||
- Don't refilter log unless filters have actually changed.
|
||||
|
||||
## v7.1.41
|
||||
- Changed copyright line in about box. #771
|
||||
- Added disconnect error messages.
|
||||
- Improved loading of large log files.
|
||||
- Swapped 'Severity' combo for 'Errors & Warnings' check box.
|
||||
|
||||
## v7.1.40
|
||||
- Fixed missing system info. #759
|
||||
- Fixed debian package problem.
|
||||
|
||||
## v7.1.39
|
||||
- Fixed deb install location problems. #718
|
||||
- Fixed shebang line. #719
|
||||
- Fixed client status message updating when paused/unpaused. #526
|
||||
- Fixed 'fah' module location problems. #669
|
||||
- Reduced tool bar font size so it fits the default window size.
|
82
FAHControl
Executable file
@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2013 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import os
|
||||
import sys
|
||||
import inspect
|
||||
import socket
|
||||
from optparse import OptionParser
|
||||
from fah import FAHControl, load_fahcontrol_db
|
||||
from fah.util import *
|
||||
from fah.db import *
|
||||
|
||||
|
||||
def set_proc_name(name):
|
||||
from ctypes import cdll, byref, create_string_buffer
|
||||
|
||||
libc = cdll.LoadLibrary('libc.so.6')
|
||||
buff = create_string_buffer(len(name)+1)
|
||||
buff.value = name
|
||||
libc.prctl(15, byref(buff), 0, 0, 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if sys.platform.startswith('linux'): set_proc_name('FAHControl')
|
||||
|
||||
# If present, remove the Launch Services -psn_xxx_xxx argument
|
||||
if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn':
|
||||
del sys.argv[1]
|
||||
|
||||
parser = OptionParser(usage = 'Usage: %prog [options]')
|
||||
|
||||
parser.add_option('--exit', help = 'Tell the running application to exit',
|
||||
action = 'store_true', dest = 'exit')
|
||||
options, args = parser.parse_args()
|
||||
|
||||
# Tell app to exit
|
||||
if options.exit:
|
||||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect(single_app_addr)
|
||||
sock.send('EXIT')
|
||||
if sock.recv(1024).strip() == 'OK': print 'Ok'
|
||||
except Exception, e: pass
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
# Add executable path to PATH
|
||||
if getattr(sys, 'frozen', False): path = os.path.dirname(sys.executable)
|
||||
else: path = os.path.dirname(__file__)
|
||||
path = os.path.realpath(path)
|
||||
os.environ['PATH'] = path + os.pathsep + os.environ['PATH']
|
||||
|
||||
# Load Glade
|
||||
dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
|
||||
if not dir: dir = '.'
|
||||
glade = dir + '/fah/FAHControl.glade'
|
||||
|
||||
if os.path.exists(glade): app = FAHControl(glade)
|
||||
else:
|
||||
from fah.FAHControl_glade import glade_data
|
||||
app = FAHControl(glade_data)
|
||||
|
||||
try:
|
||||
app.run()
|
||||
except Exception, e:
|
||||
print e
|
11
FAHControl.desktop
Normal file
@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=FAHControl
|
||||
Exec=/usr/bin/FAHControl
|
||||
TryExec=FAHControl
|
||||
StartupNotify=false
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Science;Biology;Education;;
|
||||
Comment=Folding@home Client Control
|
||||
Icon=FAHControl.png
|
674
LICENSE.txt
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
12
README.md
@ -1,4 +1,10 @@
|
||||
fah-control
|
||||
==========
|
||||
Folding@home Client Advanced Control
|
||||
====================================
|
||||
|
||||
Folding@home Client Advanced Control GUI
|
||||
FAHControl can monitor and control one or more FAHClients.
|
||||
|
||||
To run:
|
||||
|
||||
python FAHControl
|
||||
|
||||
See: https://folding.stanford.edu
|
||||
|
104
SConstruct
Normal file
@ -0,0 +1,104 @@
|
||||
# Setup
|
||||
import os
|
||||
env = Environment()
|
||||
try:
|
||||
env.Tool('config', toolpath = [os.environ.get('CBANG_HOME')])
|
||||
except Exception, e:
|
||||
raise Exception, 'CBANG_HOME not set?\n' + str(e)
|
||||
|
||||
# Override mostly_static to default True
|
||||
env.CBAddVariables(
|
||||
BoolVariable('mostly_static', 'Link most libraries statically', 1))
|
||||
|
||||
env.CBLoadTools('packager run_distutils osx')
|
||||
conf = env.CBConfigure()
|
||||
|
||||
# Version
|
||||
version = open('version/version.txt', 'r').read().strip()
|
||||
major, minor, revision = version.split('.')
|
||||
|
||||
# Config vars
|
||||
env.Replace(PACKAGE_VERSION = version)
|
||||
|
||||
if env['PLATFORM'] != 'darwin': env['package_arch'] = 'noarch'
|
||||
|
||||
# Build
|
||||
target_dir = None
|
||||
if env['PLATFORM'] == 'darwin':
|
||||
env['RUN_DISTUTILSOPTS'] = 'py2app'
|
||||
target_dir = 'dist/FAHControl.app'
|
||||
|
||||
elif env['PLATFORM'] == 'win32':
|
||||
env['RUN_DISTUTILSOPTS'] = 'build'
|
||||
target_dir = 'gui'
|
||||
target_pat = ''
|
||||
|
||||
elif env.GetPackageType() == 'deb':
|
||||
env['RUN_DISTUTILSOPTS'] = ['--command-packages=stdeb.command', 'bdist_deb']
|
||||
target_dir = 'deb_dist'
|
||||
target_pat = 'deb_dist/fahcontrol_%s-*.deb' % version
|
||||
|
||||
# Run distutils
|
||||
gui = None
|
||||
if env.GetPackageType() != 'rpm':
|
||||
# Cleanup old GUI build
|
||||
# Note: py2app does not work correctly if the old .app is still around
|
||||
import shutil
|
||||
shutil.rmtree(target_dir, True)
|
||||
|
||||
gui = env.RunDistUtils(Dir(target_dir), 'setup.py')
|
||||
Default(gui)
|
||||
AlwaysBuild(gui)
|
||||
|
||||
|
||||
# Package
|
||||
if env['PLATFORM'] == 'darwin' or env.GetPackageType() == 'rpm':
|
||||
pkg = env.Packager(
|
||||
'FAHControl',
|
||||
|
||||
version = version,
|
||||
maintainer = 'Joseph Coffland <joseph@cauldrondevelopment.com>',
|
||||
vendor = 'Folding@home',
|
||||
url = 'http://folding.stanford.edu/',
|
||||
license = 'LICENSE.txt',
|
||||
bug_url = 'https://fah-web.stanford.edu/projects/FAHClient/',
|
||||
summary = 'Folding@home Control',
|
||||
description = \
|
||||
'Control and monitor local and remote Folding@home clients',
|
||||
prefix = '/usr',
|
||||
|
||||
documents = ['README.txt', 'LICENSE.txt'],
|
||||
desktop_menu = ['FAHControl.desktop'],
|
||||
icons = ['images/FAHControl.png'],
|
||||
|
||||
rpm_license = 'GPL v3+',
|
||||
rpm_group = 'Applications/Internet',
|
||||
rpm_requires = 'python, pygtk2',
|
||||
rpm_build = 'rpm/build',
|
||||
rpm_filelist = 'filelist.txt',
|
||||
|
||||
pkg_id = 'edu.stanford.folding.fahcontrol.pkg',
|
||||
pkg_resources = [['osx/Resources', '.']],
|
||||
pkg_apps = [['dist/FAHControl.app', 'Folding@home/FAHControl.app']],
|
||||
pkg_scripts = 'osx/scripts',
|
||||
pkg_target = '10.4',
|
||||
)
|
||||
|
||||
AlwaysBuild(pkg)
|
||||
env.Alias('package', pkg)
|
||||
if gui is not None: Depends(pkg, gui)
|
||||
|
||||
else:
|
||||
# Write package.txt
|
||||
def write_filename(target, source, env):
|
||||
import glob
|
||||
filename = str(Glob(target_pat)[0])
|
||||
open(str(target[0]), 'w').write(filename)
|
||||
|
||||
bld = Builder(action = write_filename)
|
||||
env.Append(BUILDERS = {'WriteFilename' : bld})
|
||||
cmd = env.WriteFilename('package.txt', [])
|
||||
AlwaysBuild(cmd)
|
||||
if gui is not None: Depends(cmd, gui)
|
||||
|
||||
env.Alias('package', [cmd])
|
24
debian/copyright
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
Format: http://dep.debian.net/deps/dep5
|
||||
Upstream-Name: fahcontrol
|
||||
Source: https://fah-web.stanford.edu/svn/pub/trunk/
|
||||
|
||||
Files: *
|
||||
Copyright: 2010-2014 Stanford University
|
||||
License: GPL-3.0+
|
||||
|
||||
License: GPL-3.0+
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
284
ez_setup.py
Normal file
@ -0,0 +1,284 @@
|
||||
#!python
|
||||
"""Bootstrap setuptools installation
|
||||
|
||||
If you want to use setuptools in your package's setup.py, just include this
|
||||
file in the same directory with it, and add this to the top of your setup.py::
|
||||
|
||||
from ez_setup import use_setuptools
|
||||
use_setuptools()
|
||||
|
||||
If you want to require a specific version of setuptools, set a download
|
||||
mirror, or use an alternate download directory, you can do so by supplying
|
||||
the appropriate options to ``use_setuptools()``.
|
||||
|
||||
This file can also be run as a script to install or upgrade setuptools.
|
||||
"""
|
||||
import sys
|
||||
DEFAULT_VERSION = "0.6c11"
|
||||
DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
|
||||
|
||||
md5_data = {
|
||||
'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
|
||||
'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
|
||||
'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
|
||||
'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
|
||||
'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
|
||||
'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
|
||||
'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
|
||||
'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
|
||||
'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
|
||||
'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
|
||||
'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090',
|
||||
'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4',
|
||||
'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7',
|
||||
'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5',
|
||||
'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
|
||||
'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b',
|
||||
'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
|
||||
'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086',
|
||||
'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
|
||||
'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
|
||||
'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
|
||||
'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
|
||||
'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
|
||||
'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
|
||||
'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
|
||||
'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
|
||||
'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
|
||||
'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
|
||||
'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
|
||||
'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
|
||||
'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
|
||||
'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
|
||||
'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
|
||||
'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
|
||||
'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
|
||||
'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
|
||||
'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
|
||||
'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
|
||||
'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03',
|
||||
'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
|
||||
'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
|
||||
'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a',
|
||||
}
|
||||
|
||||
import sys, os
|
||||
try: from hashlib import md5
|
||||
except ImportError: from md5 import md5
|
||||
|
||||
def _validate_md5(egg_name, data):
|
||||
if egg_name in md5_data:
|
||||
digest = md5(data).hexdigest()
|
||||
if digest != md5_data[egg_name]:
|
||||
print >>sys.stderr, (
|
||||
"md5 validation of %s failed! (Possible download problem?)"
|
||||
% egg_name
|
||||
)
|
||||
sys.exit(2)
|
||||
return data
|
||||
|
||||
def use_setuptools(
|
||||
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
|
||||
download_delay=15
|
||||
):
|
||||
"""Automatically find/download setuptools and make it available on sys.path
|
||||
|
||||
`version` should be a valid setuptools version number that is available
|
||||
as an egg for download under the `download_base` URL (which should end with
|
||||
a '/'). `to_dir` is the directory where setuptools will be downloaded, if
|
||||
it is not already available. If `download_delay` is specified, it should
|
||||
be the number of seconds that will be paused before initiating a download,
|
||||
should one be required. If an older version of setuptools is installed,
|
||||
this routine will print a message to ``sys.stderr`` and raise SystemExit in
|
||||
an attempt to abort the calling script.
|
||||
"""
|
||||
was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
|
||||
def do_download():
|
||||
egg = download_setuptools(version, download_base, to_dir, download_delay)
|
||||
sys.path.insert(0, egg)
|
||||
import setuptools; setuptools.bootstrap_install_from = egg
|
||||
try:
|
||||
import pkg_resources
|
||||
except ImportError:
|
||||
return do_download()
|
||||
try:
|
||||
pkg_resources.require("setuptools>="+version); return
|
||||
except pkg_resources.VersionConflict, e:
|
||||
if was_imported:
|
||||
print >>sys.stderr, (
|
||||
"The required version of setuptools (>=%s) is not available, and\n"
|
||||
"can't be installed while this script is running. Please install\n"
|
||||
" a more recent version first, using 'easy_install -U setuptools'."
|
||||
"\n\n(Currently using %r)"
|
||||
) % (version, e.args[0])
|
||||
sys.exit(2)
|
||||
else:
|
||||
del pkg_resources, sys.modules['pkg_resources'] # reload ok
|
||||
return do_download()
|
||||
except pkg_resources.DistributionNotFound:
|
||||
return do_download()
|
||||
|
||||
def download_setuptools(
|
||||
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
|
||||
delay = 15
|
||||
):
|
||||
"""Download setuptools from a specified location and return its filename
|
||||
|
||||
`version` should be a valid setuptools version number that is available
|
||||
as an egg for download under the `download_base` URL (which should end
|
||||
with a '/'). `to_dir` is the directory where the egg will be downloaded.
|
||||
`delay` is the number of seconds to pause before an actual download attempt.
|
||||
"""
|
||||
import urllib2, shutil
|
||||
egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
|
||||
url = download_base + egg_name
|
||||
saveto = os.path.join(to_dir, egg_name)
|
||||
src = dst = None
|
||||
if not os.path.exists(saveto): # Avoid repeated downloads
|
||||
try:
|
||||
from distutils import log
|
||||
if delay:
|
||||
log.warn("""
|
||||
---------------------------------------------------------------------------
|
||||
This script requires setuptools version %s to run (even to display
|
||||
help). I will attempt to download it for you (from
|
||||
%s), but
|
||||
you may need to enable firewall access for this script first.
|
||||
I will start the download in %d seconds.
|
||||
|
||||
(Note: if this machine does not have network access, please obtain the file
|
||||
|
||||
%s
|
||||
|
||||
and place it in this directory before rerunning this script.)
|
||||
---------------------------------------------------------------------------""",
|
||||
version, download_base, delay, url
|
||||
); from time import sleep; sleep(delay)
|
||||
log.warn("Downloading %s", url)
|
||||
src = urllib2.urlopen(url)
|
||||
# Read/write all in one block, so we don't create a corrupt file
|
||||
# if the download is interrupted.
|
||||
data = _validate_md5(egg_name, src.read())
|
||||
dst = open(saveto,"wb"); dst.write(data)
|
||||
finally:
|
||||
if src: src.close()
|
||||
if dst: dst.close()
|
||||
return os.path.realpath(saveto)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def main(argv, version=DEFAULT_VERSION):
|
||||
"""Install or upgrade setuptools and EasyInstall"""
|
||||
try:
|
||||
import setuptools
|
||||
except ImportError:
|
||||
egg = None
|
||||
try:
|
||||
egg = download_setuptools(version, delay=0)
|
||||
sys.path.insert(0,egg)
|
||||
from setuptools.command.easy_install import main
|
||||
return main(list(argv)+[egg]) # we're done here
|
||||
finally:
|
||||
if egg and os.path.exists(egg):
|
||||
os.unlink(egg)
|
||||
else:
|
||||
if setuptools.__version__ == '0.0.1':
|
||||
print >>sys.stderr, (
|
||||
"You have an obsolete version of setuptools installed. Please\n"
|
||||
"remove it from your system entirely before rerunning this script."
|
||||
)
|
||||
sys.exit(2)
|
||||
|
||||
req = "setuptools>="+version
|
||||
import pkg_resources
|
||||
try:
|
||||
pkg_resources.require(req)
|
||||
except pkg_resources.VersionConflict:
|
||||
try:
|
||||
from setuptools.command.easy_install import main
|
||||
except ImportError:
|
||||
from easy_install import main
|
||||
main(list(argv)+[download_setuptools(delay=0)])
|
||||
sys.exit(0) # try to force an exit
|
||||
else:
|
||||
if argv:
|
||||
from setuptools.command.easy_install import main
|
||||
main(argv)
|
||||
else:
|
||||
print "Setuptools version",version,"or greater has been installed."
|
||||
print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
|
||||
|
||||
def update_md5(filenames):
|
||||
"""Update our built-in md5 registry"""
|
||||
|
||||
import re
|
||||
|
||||
for name in filenames:
|
||||
base = os.path.basename(name)
|
||||
f = open(name,'rb')
|
||||
md5_data[base] = md5(f.read()).hexdigest()
|
||||
f.close()
|
||||
|
||||
data = [" %r: %r,\n" % it for it in md5_data.items()]
|
||||
data.sort()
|
||||
repl = "".join(data)
|
||||
|
||||
import inspect
|
||||
srcfile = inspect.getsourcefile(sys.modules[__name__])
|
||||
f = open(srcfile, 'rb'); src = f.read(); f.close()
|
||||
|
||||
match = re.search("\nmd5_data = {\n([^}]+)}", src)
|
||||
if not match:
|
||||
print >>sys.stderr, "Internal error!"
|
||||
sys.exit(2)
|
||||
|
||||
src = src[:match.start(1)] + repl + src[match.end(1):]
|
||||
f = open(srcfile,'w')
|
||||
f.write(src)
|
||||
f.close()
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
if len(sys.argv)>2 and sys.argv[1]=='--md5update':
|
||||
update_md5(sys.argv[2:])
|
||||
else:
|
||||
main(sys.argv[1:])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
405
fah/Client.py
Normal file
@ -0,0 +1,405 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import traceback
|
||||
import time
|
||||
import re
|
||||
import copy
|
||||
import collections
|
||||
import gtk
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
import signal
|
||||
import os
|
||||
import shlex
|
||||
|
||||
if sys.platform == 'win32':
|
||||
import win32api
|
||||
import win32con
|
||||
|
||||
from fah import *
|
||||
from fah.util import status_to_color, make_row, get_home_dir
|
||||
|
||||
debug = False
|
||||
|
||||
|
||||
class Client:
|
||||
def __init__(self, app, name, address, port, password):
|
||||
self.name = name
|
||||
self.address = address
|
||||
self.port = port
|
||||
self.password = password
|
||||
|
||||
self.set_updated(False)
|
||||
self.selected = False
|
||||
self.ppd = 0
|
||||
self.power = ''
|
||||
|
||||
self.error_messages = set()
|
||||
|
||||
if not name: self.name = self.get_address()
|
||||
|
||||
# Option names
|
||||
names = app.client_option_widgets.keys()
|
||||
self.option_names = map(lambda name: name.replace('_', '-'), names)
|
||||
self.option_names.append('power') # Folding power
|
||||
|
||||
# Init commands
|
||||
self.inactive_cmds = [
|
||||
'updates clear',
|
||||
'updates add 0 4 $heartbeat',
|
||||
'updates add 1 5 $ppd',
|
||||
]
|
||||
|
||||
self.active_cmds = self.inactive_cmds + [
|
||||
'updates add 2 1 $(options %s *)' % ' '.join(self.option_names),
|
||||
'updates add 3 4 $queue-info',
|
||||
'updates add 4 1 $slot-info',
|
||||
'info',
|
||||
'log-updates start',
|
||||
'configured',
|
||||
]
|
||||
|
||||
# Objects
|
||||
self.config = ClientConfig()
|
||||
self.conn = Connection(self.address, self.port, self.password)
|
||||
self.conn.set_init_commands(self.inactive_cmds)
|
||||
|
||||
|
||||
# Class special functions
|
||||
def __str__(self): return self.name
|
||||
def __cmp__(self, other): return str.__cmp__(self.name, other.name)
|
||||
def __hash__(self): return self.name.__hash__()
|
||||
|
||||
|
||||
# Getters
|
||||
@staticmethod
|
||||
def make_address(address, port): return '%s:%d' % (address, port)
|
||||
def get_address(self): return Client.make_address(self.address, self.port)
|
||||
def get_password(self): return self.conn.password
|
||||
|
||||
|
||||
def get_status(self):
|
||||
status = self.conn.get_status()
|
||||
if status == 'Online' and not self.is_updated() and self.selected:
|
||||
return 'Updating'
|
||||
return status
|
||||
|
||||
|
||||
def get_selected_slot(self, app): return self.config.get_selected_slot(app)
|
||||
|
||||
|
||||
# Setters
|
||||
def set_address(self, address, port):
|
||||
self.conn.address = self.address = address
|
||||
self.conn.port = self.port = port
|
||||
|
||||
def set_password(self, password):
|
||||
self.conn.password = self.password = password
|
||||
|
||||
|
||||
# State functions
|
||||
def is_local(self):
|
||||
return self.address == '127.0.0.1' and self.name == 'local'
|
||||
def is_online(self): return self.conn.get_status() == 'Online'
|
||||
|
||||
def set_selected(self, selected):
|
||||
if self.selected != selected:
|
||||
if selected:
|
||||
self.set_updated(False)
|
||||
self.conn.set_init_commands(self.active_cmds)
|
||||
else: self.conn.set_init_commands(self.inactive_cmds)
|
||||
|
||||
self.selected = selected
|
||||
|
||||
|
||||
def set_updated(self, updated):
|
||||
self.options_updated = updated
|
||||
self.info_updated = updated
|
||||
self.slots_updated = updated
|
||||
self.units_updated = updated
|
||||
|
||||
|
||||
def is_updated(self):
|
||||
return self.options_updated and self.info_updated and \
|
||||
self.slots_updated and self.units_updated
|
||||
|
||||
|
||||
# Log functions
|
||||
def refresh_log(self):
|
||||
self.conn.queue_command('log-updates restart')
|
||||
|
||||
|
||||
# GUI functions
|
||||
def load_dialog(self, app):
|
||||
app.client_entries['name'].set_text(self.name)
|
||||
app.client_entries['name'].set_sensitive(self.name != 'local')
|
||||
app.client_entries['address'].set_text(self.address)
|
||||
app.client_entries['address'].set_sensitive(self.name != 'local')
|
||||
app.client_entries['port'].set_value(self.port)
|
||||
app.client_entries['password'].set_text(self.password)
|
||||
if self.is_updated():
|
||||
self.config.update_options(app)
|
||||
self.config.update_slots_ui(app)
|
||||
|
||||
def get_row(self, app):
|
||||
status = self.get_status()
|
||||
keys = {'name': self.name, 'status': status,
|
||||
'status_color': status_to_color(status),
|
||||
'address': self.get_address()}
|
||||
return list(make_row(app.client_cols, keys))
|
||||
|
||||
|
||||
def update_status_ui(self, app):
|
||||
self.config.update_status_ui(app)
|
||||
|
||||
|
||||
def reset_status_ui(self, app):
|
||||
self.config.reset_status_ui(app)
|
||||
|
||||
|
||||
# Slot control
|
||||
def unpause(self, slot = ''):
|
||||
self.conn.queue_command('unpause %s' % str(slot))
|
||||
|
||||
|
||||
def pause(self, slot = ''):
|
||||
self.conn.queue_command('pause %s' % str(slot))
|
||||
|
||||
|
||||
def finish(self, slot = ''):
|
||||
self.conn.queue_command('finish %s' % str(slot))
|
||||
|
||||
|
||||
def on_idle(self, slot = ''):
|
||||
self.conn.queue_command('on_idle %s' % str(slot))
|
||||
|
||||
|
||||
def always_on(self, slot = ''):
|
||||
self.conn.queue_command('always_on %s' % str(slot))
|
||||
|
||||
|
||||
# Save functions
|
||||
def save(self, db):
|
||||
db.insert('clients', name = self.name, address = self.address,
|
||||
port = self.port, password = self.password)
|
||||
|
||||
|
||||
def save_options(self, options):
|
||||
if not options: return
|
||||
|
||||
cmd = 'options'
|
||||
|
||||
for name, value in options.items():
|
||||
cmd += ' ' + name
|
||||
if name[-1] != '!':
|
||||
cmd += "='%s'" % value.encode('string_escape')
|
||||
|
||||
cmd += ' %s *' % ' '.join(self.option_names)
|
||||
|
||||
self.conn.queue_command(cmd)
|
||||
self.options_updated = False # Reload
|
||||
|
||||
|
||||
def save_slots(self, slots):
|
||||
if not slots or slots == ([], [], []): return
|
||||
|
||||
deleted, added, modified = slots
|
||||
|
||||
# Deleted
|
||||
for id in deleted:
|
||||
self.conn.queue_command('slot-delete %d' % id)
|
||||
|
||||
# Modified
|
||||
for id, type, options in modified:
|
||||
cmd = 'slot-modify %d %s' % (id, type)
|
||||
for name, value in options.items():
|
||||
if name[-1] == '!': cmd += ' ' + name
|
||||
else: cmd += ' %s="%s"' % (name, value)
|
||||
self.conn.queue_command(cmd)
|
||||
|
||||
# Added
|
||||
for type, options in added:
|
||||
cmd = 'slot-add %s' % type
|
||||
for name, value in options.items():
|
||||
cmd += ' %s="%s"' % (name, value)
|
||||
self.conn.queue_command(cmd)
|
||||
|
||||
self.slots_updated = False # Reload
|
||||
|
||||
|
||||
def save_config(self, options, slots):
|
||||
if not options and slots == ([], [], []): return
|
||||
|
||||
self.save_options(options)
|
||||
self.save_slots(slots)
|
||||
|
||||
self.conn.queue_command('save')
|
||||
self.conn.queue_command('updates reset')
|
||||
|
||||
|
||||
def set_power(self, power):
|
||||
power = power.lower().replace(' ', '_')
|
||||
if power != self.power:
|
||||
self.power = power
|
||||
self.conn.queue_command('option power ' + power)
|
||||
|
||||
|
||||
# Message processing
|
||||
def process_options(self, app, data):
|
||||
self.options_updated = True
|
||||
self.config.options = data
|
||||
if self.selected:
|
||||
self.config.update_options(app)
|
||||
self.config.update_user_info(app)
|
||||
self.config.update_ppd(app, self.ppd)
|
||||
|
||||
|
||||
def process_info(self, app, data):
|
||||
self.info_updated = True
|
||||
self.config.info = data
|
||||
if self.selected: self.config.update_info(app)
|
||||
|
||||
|
||||
def process_slots(self, app, data):
|
||||
self.slots_updated = True
|
||||
slots = []
|
||||
for slot in data: slots.append(SlotConfig(**slot))
|
||||
self.config.slots = slots
|
||||
if self.selected: self.config.update_status_ui(app)
|
||||
|
||||
|
||||
def process_units(self, app, data):
|
||||
self.units_updated = True
|
||||
self.config.update_queue(data)
|
||||
if self.selected: self.config.update_status_ui(app)
|
||||
|
||||
|
||||
def process_log_update(self, app, data):
|
||||
# Remove color codes
|
||||
data = re.sub(r'\033\[\d\d?m', '', data)
|
||||
|
||||
self.config.log_add(app, data)
|
||||
|
||||
|
||||
def process_log_restart(self, app, data):
|
||||
self.config.log_clear(app)
|
||||
self.process_log_update(app, data)
|
||||
|
||||
|
||||
def process_ppd(self, app, ppd):
|
||||
self.ppd = ppd
|
||||
if self.selected: self.config.update_ppd(app, ppd)
|
||||
|
||||
|
||||
def process_error(self, app, data):
|
||||
msg = 'On client "%s" %s:%d: %s' % (
|
||||
self.name, self.address, self.port, data)
|
||||
|
||||
# Only popup dialog once for each error
|
||||
if not msg in self.error_messages:
|
||||
self.error_messages.add(msg)
|
||||
app.error(msg)
|
||||
|
||||
else: print 'ERROR:', msg
|
||||
|
||||
app.set_status(msg)
|
||||
|
||||
def process_configured(self, app, configured):
|
||||
if configured: return
|
||||
app.configure_dialog.show()
|
||||
|
||||
|
||||
def process_message(self, app, type, data):
|
||||
if debug: print 'message:', type, data
|
||||
|
||||
if type == 'heartbeat': return
|
||||
if type == 'ppd': self.process_ppd(app, data)
|
||||
|
||||
if not self.selected: return
|
||||
|
||||
if type == 'options': self.process_options(app, data)
|
||||
elif type == 'info': self.process_info(app, data)
|
||||
elif type == 'slots': self.process_slots(app, data)
|
||||
elif type == 'units': self.process_units(app, data)
|
||||
elif type == 'log-restart': self.process_log_restart(app, data)
|
||||
elif type == 'log-update': self.process_log_update(app, data)
|
||||
elif type == 'error': self.process_error(app, data)
|
||||
elif type == 'configured': self.process_configured(app, data)
|
||||
# Ignore other message types
|
||||
|
||||
|
||||
def update(self, app):
|
||||
prevStatus = self.get_status()
|
||||
|
||||
try:
|
||||
self.conn.update()
|
||||
|
||||
for version, type, data in self.conn.messages:
|
||||
try:
|
||||
self.process_message(app, type, data)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
|
||||
self.conn.messages = []
|
||||
|
||||
except Exception, e:
|
||||
print e
|
||||
|
||||
# If client status has changed update UI
|
||||
newStatus = self.get_status()
|
||||
if prevStatus != newStatus:
|
||||
list = app.client_list
|
||||
iter = list.get_iter_first()
|
||||
while iter is not None:
|
||||
name, status = app.client_list.get(iter, 0, 1)
|
||||
|
||||
if name == self.name:
|
||||
# Update client status and colors
|
||||
color = status_to_color(newStatus)
|
||||
path = list.get_path(iter)
|
||||
list.set(iter, 1, newStatus)
|
||||
list.set(iter, 2, color)
|
||||
list.row_changed(path, iter)
|
||||
break
|
||||
|
||||
iter = list.iter_next(iter)
|
||||
|
||||
if not self.is_online(): self.set_updated(False)
|
||||
|
||||
# Update client status label
|
||||
if self.selected: app.update_client_status()
|
||||
|
||||
|
||||
def reconnect(self):
|
||||
self.conn.close()
|
||||
|
||||
|
||||
def close(self):
|
||||
# Avoid broken pipe on OSX
|
||||
if sys.platform == 'darwin':
|
||||
try:
|
||||
if self.conn.is_connected():
|
||||
self.conn.queue_command('quit')
|
||||
self.conn.write_some()
|
||||
|
||||
except Exception, e:
|
||||
print e
|
||||
|
||||
self.conn.close()
|
673
fah/ClientConfig.py
Normal file
@ -0,0 +1,673 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import sys
|
||||
import gtk
|
||||
import traceback
|
||||
import re
|
||||
|
||||
from fah.util import parse_bool
|
||||
from fah.util import status_to_color
|
||||
from fah.util import get_span_markup
|
||||
from fah.util import get_widget_str_value
|
||||
from fah.util import set_widget_str_value
|
||||
from fah import SlotConfig
|
||||
|
||||
|
||||
def get_option_mods(old_options, new_options):
|
||||
changes = {}
|
||||
|
||||
# Deleted
|
||||
for name in old_options:
|
||||
if name not in new_options:
|
||||
changes[name + '!'] = None
|
||||
|
||||
# Added and modified
|
||||
for name, value in new_options.items():
|
||||
if name not in old_options or value != old_options[name]:
|
||||
changes[name] = value
|
||||
|
||||
return changes
|
||||
|
||||
def get_buffer_text(buffer):
|
||||
return buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter())
|
||||
|
||||
|
||||
def get_model_column(model, iter, column):
|
||||
if iter is not None: return model.get_value(iter, column)
|
||||
|
||||
|
||||
def get_selected_tree_column(tree, column):
|
||||
selection = tree.get_selection()
|
||||
model = tree.get_model()
|
||||
if selection is not None:
|
||||
return get_model_column(model, selection.get_selected()[1], column)
|
||||
|
||||
|
||||
def get_active_combo_column(combo, column):
|
||||
return get_model_column(combo.get_model(), combo.get_active_iter(), column)
|
||||
|
||||
|
||||
class ClientConfig:
|
||||
queue_cols = ('id state statecolor percentdone percent').split()
|
||||
|
||||
def __init__(self):
|
||||
self.last_updated = 0
|
||||
self.queue = []
|
||||
self.queue_map = {}
|
||||
self.slots = []
|
||||
self.options = {}
|
||||
self.core_options = {}
|
||||
self.info = []
|
||||
self.log = []
|
||||
self.log_append_count = 0
|
||||
self.tooltip = ''
|
||||
self.last_log_filter = ''
|
||||
self.log_filter_re = None
|
||||
self.updating = False
|
||||
|
||||
|
||||
def get(self, name):
|
||||
if name in self.options: return self.options[name]
|
||||
def set(self, name, value): self.options[name] = value
|
||||
def have(self, name):
|
||||
return name in self.options and self.options[name] is not None
|
||||
|
||||
|
||||
def get_prcg(self, row):
|
||||
return '%s (%s, %s, %s)' % (
|
||||
row['project'], row['run'], row['clone'], row['gen'])
|
||||
|
||||
|
||||
def update_power(self, app):
|
||||
power = self.get('power').lower()
|
||||
for i in range(len(app.folding_power_levels)):
|
||||
if power == app.folding_power_levels[i].lower():
|
||||
app.folding_power.set_value(i)
|
||||
|
||||
|
||||
def update_ppd(self, app, ppd):
|
||||
if ppd: s = '%d' % int(ppd)
|
||||
else: s = 'Unknown'
|
||||
app.client_ppd.set_text(s)
|
||||
|
||||
|
||||
def update_queue(self, queue):
|
||||
self.queue = queue
|
||||
self.queue_map = {}
|
||||
for values in self.queue:
|
||||
self.queue_map[values['id']] = values
|
||||
|
||||
|
||||
def update_user_info(self, app):
|
||||
# User
|
||||
user = self.options['user']
|
||||
app.donor_info.set_label(user)
|
||||
|
||||
# Team
|
||||
team = self.options['team']
|
||||
app.team_info.set_label(team)
|
||||
|
||||
|
||||
def reset_user_info(self, app):
|
||||
app.donor_info.set_label('')
|
||||
app.team_info.set_label('')
|
||||
|
||||
|
||||
def get_selected_queue_entry(self, app):
|
||||
return get_selected_tree_column(app.queue_tree, 1)
|
||||
|
||||
|
||||
def get_selected_slot(self, app):
|
||||
id = get_selected_tree_column(app.slot_status_tree, 0)
|
||||
if id is not None:
|
||||
id = int(id)
|
||||
for slot in self.slots:
|
||||
if slot.id == id: return slot
|
||||
|
||||
def update_queue_ui(self, app):
|
||||
if not self.queue:
|
||||
app.queue_list.clear()
|
||||
return
|
||||
|
||||
# Save selections
|
||||
selected = self.get_selected_queue_entry(app)
|
||||
selected_row = None
|
||||
log_filter_selected = get_active_combo_column(app.log_unit, 1)
|
||||
log_filter_row = None
|
||||
|
||||
# Clear queue wo/ updating log filter
|
||||
self.updating = True
|
||||
try:
|
||||
app.queue_list.clear()
|
||||
finally:
|
||||
self.updating = False
|
||||
|
||||
# Reload queue list
|
||||
for values in sorted(self.queue, lambda x, y: cmp(x['id'], y['id'])):
|
||||
unit_id = values['unit']
|
||||
queue_id = values['id']
|
||||
status = values['state'].title()
|
||||
color = status_to_color(status)
|
||||
status = get_span_markup(status, color)
|
||||
progress = values['percentdone']
|
||||
percent = float(progress[:-1])
|
||||
eta = values['eta']
|
||||
if eta == '0.00 secs': eta = 'Unknown'
|
||||
credit = values['creditestimate']
|
||||
if float(credit) == 0: credit = 'Unknown'
|
||||
|
||||
prcg = self.get_prcg(values)
|
||||
iter = app.queue_list.append([unit_id, queue_id, status, color,
|
||||
progress, percent, eta, credit, prcg])
|
||||
|
||||
if queue_id == selected: selected_row = iter
|
||||
if queue_id == log_filter_selected: log_filter_row = iter
|
||||
|
||||
# Select the first item if nothing is selected
|
||||
if selected_row is None: selected_row = app.queue_list.get_iter_first()
|
||||
if log_filter_row is None:
|
||||
log_filter_row = app.queue_list.get_iter_first()
|
||||
|
||||
# Restore selections
|
||||
app.queue_tree.get_selection().select_iter(selected_row)
|
||||
app.log_unit.set_active_iter(log_filter_row)
|
||||
|
||||
|
||||
def update_work_unit_info(self, app):
|
||||
if not self.queue:
|
||||
self.reset_work_unit_info(app)
|
||||
return
|
||||
|
||||
# Get selected queue entry
|
||||
selected = self.get_selected_queue_entry(app)
|
||||
if selected is None: return
|
||||
entry = self.queue_map[selected]
|
||||
|
||||
# Load info
|
||||
for name, value in entry.items():
|
||||
if name in app.queue_widgets:
|
||||
if (name in ['basecredit', 'creditestimate', 'ppd'] and \
|
||||
float(value) == 0) or value == '<invalid>' or \
|
||||
value == '0.00 secs': value = 'Unknown'
|
||||
|
||||
widget = app.queue_widgets[name]
|
||||
set_widget_str_value(widget, value)
|
||||
|
||||
# Status
|
||||
status = entry['state'].title()
|
||||
color = status_to_color(status)
|
||||
status = get_span_markup(status, color)
|
||||
widget = app.queue_widgets['state']
|
||||
widget.set_markup(status)
|
||||
|
||||
# PRCG
|
||||
prcg = '%s (%s, %s, %s)' % (
|
||||
entry['project'], entry['run'], entry['clone'], entry['gen'])
|
||||
set_widget_str_value(app.queue_widgets['prcg'], prcg)
|
||||
|
||||
# Links
|
||||
for name in ['cs', 'ws', 'project']:
|
||||
widget = app.queue_widgets[name]
|
||||
value = str(entry[name])
|
||||
|
||||
if name in ['cs', 'ws']:
|
||||
uri = 'http://fah-web.stanford.edu/logs/%s.log.html' % value
|
||||
else:
|
||||
uri = 'http://fah-web.stanford.edu/cgi-bin/fahproject.' \
|
||||
'overusingIPswillbebanned?p=' + value
|
||||
|
||||
widget.set_uri(uri)
|
||||
|
||||
|
||||
def select_slot(self, app):
|
||||
# Get selected slot
|
||||
slot = self.get_selected_slot(app)
|
||||
if slot is None: return
|
||||
|
||||
# Get associated queue ID
|
||||
first_id = None
|
||||
first_running_id = None
|
||||
for entry in self.queue:
|
||||
if int(entry['slot']) == slot.id:
|
||||
if first_id is None: first_id = entry['unit']
|
||||
if entry['state'].upper() in ['RUNNING', 'FINISHING'] and \
|
||||
first_running_id is None:
|
||||
first_running_id = entry['unit']
|
||||
|
||||
if first_running_id is not None: unit_id = first_running_id
|
||||
else: unit_id = first_id
|
||||
|
||||
if unit_id is not None:
|
||||
# Find unit_id in the queue list entry and select row
|
||||
list = app.queue_list
|
||||
iter = list.get_iter_first()
|
||||
while iter is not None:
|
||||
if list.get_value(iter, 0) == unit_id:
|
||||
app.queue_tree.get_selection().select_iter(iter)
|
||||
break
|
||||
iter = list.iter_next(iter)
|
||||
|
||||
# Update the UI
|
||||
self.update_work_unit_info(app)
|
||||
|
||||
|
||||
def select_queue_slot(self, app):
|
||||
# Get unit ID of selected queue entry
|
||||
selected = self.get_selected_queue_entry(app)
|
||||
if selected is None: return
|
||||
|
||||
# Get associated slot ID
|
||||
entry = self.queue_map[selected]
|
||||
slot = int(entry['slot'])
|
||||
|
||||
# Find and select the slot
|
||||
list = app.slot_status_list
|
||||
iter = list.get_iter_first()
|
||||
while iter is not None:
|
||||
if int(list.get_value(iter, 0)) == slot:
|
||||
app.slot_status_tree.get_selection().select_iter(iter)
|
||||
break
|
||||
iter = list.iter_next(iter)
|
||||
|
||||
# Update the UI
|
||||
self.update_work_unit_info(app)
|
||||
|
||||
|
||||
def reset_work_unit_info(self, app):
|
||||
for widget in app.queue_widgets.values():
|
||||
set_widget_str_value(widget, None)
|
||||
|
||||
|
||||
def update_info(self, app):
|
||||
port = app.info
|
||||
|
||||
# Clear
|
||||
for child in port.get_children(): port.remove(child)
|
||||
|
||||
# Alignment
|
||||
align = gtk.Alignment(0, 0, 1, 1)
|
||||
align.set_padding(4, 4, 4, 4)
|
||||
port.add(align)
|
||||
|
||||
# Vertical box
|
||||
vbox = gtk.VBox()
|
||||
align.add(vbox)
|
||||
|
||||
for category in self.info:
|
||||
name = category[0]
|
||||
category = category[1:]
|
||||
|
||||
# Frame
|
||||
frame = gtk.Frame('<b>%s</b>' % name)
|
||||
frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
|
||||
frame.get_label_widget().set_use_markup(True)
|
||||
vbox.pack_start(frame, False)
|
||||
|
||||
# Alignment
|
||||
align = gtk.Alignment(0, 0, 1, 1)
|
||||
align.set_padding(0, 0, 12, 0)
|
||||
frame.add(align)
|
||||
|
||||
# Table
|
||||
table = gtk.Table(len(category), 2)
|
||||
table.set_col_spacing(0, 5)
|
||||
align.add(table)
|
||||
|
||||
row = 0
|
||||
for name, value in category:
|
||||
# Name
|
||||
label = gtk.Label('<b>%s</b>' % name)
|
||||
label.set_use_markup(True)
|
||||
label.set_alignment(1, 0.5)
|
||||
table.attach(label, 0, 1, row, row + 1, gtk.FILL, gtk.FILL)
|
||||
|
||||
# Value
|
||||
if value.startswith('http://'):
|
||||
label = gtk.LinkButton(value, value)
|
||||
label.set_relief(gtk.RELIEF_NONE)
|
||||
label.set_property('can-focus', False)
|
||||
|
||||
else: label = gtk.Label(value)
|
||||
|
||||
label.set_alignment(0, 0.5)
|
||||
label.modify_font(app.mono_font)
|
||||
table.attach(label, 1, 2, row, row + 1, yoptions = gtk.FILL)
|
||||
|
||||
row += 1
|
||||
|
||||
port.realize()
|
||||
port.show_all()
|
||||
|
||||
|
||||
def update_options(self, app):
|
||||
used = set()
|
||||
|
||||
for name, widget in app.client_option_widgets.items():
|
||||
name = name.replace('_', '-')
|
||||
used.add(name)
|
||||
|
||||
try:
|
||||
set_widget_str_value(widget, self.options[name])
|
||||
|
||||
except: # Don't let one bad widget kill everything
|
||||
print 'WARNING: failed to set widget "%s"' % name
|
||||
|
||||
# Setup passkey and password entries
|
||||
app.passkey_validator.set_good()
|
||||
app.password_validator.set_good()
|
||||
app.proxy_pass_validator.set_good()
|
||||
|
||||
# Set folding power
|
||||
if 'power' in self.options:
|
||||
used.add('power')
|
||||
self.update_power(app)
|
||||
|
||||
# Set proxy options
|
||||
if 'proxy-enable' in self.options:
|
||||
proxy_enable = parse_bool(self.get('proxy-enable'))
|
||||
app.proxy_frame.set_sensitive(proxy_enable)
|
||||
app.proxy_auth_frame.set_sensitive(proxy_enable)
|
||||
|
||||
if self.have('proxy'):
|
||||
proxy = self.get('proxy')
|
||||
if ':' in proxy: proxy_addr, proxy_port = proxy.split(':', 1)
|
||||
else: proxy_addr, proxy_port = proxy, '8080'
|
||||
set_widget_str_value(app.client_option_widgets['proxy'], proxy_addr)
|
||||
set_widget_str_value(app.proxy_port, proxy_port)
|
||||
|
||||
# Set core priority radio button
|
||||
core_idle = not self.have('core-priority') or \
|
||||
self.get('core-priority') == 'idle'
|
||||
app.client_option_widgets['core_priority'].set_active(core_idle)
|
||||
app.core_priority_low.set_active(not core_idle)
|
||||
|
||||
# Extra core options
|
||||
app.core_option_list.clear()
|
||||
if self.have('extra-core-args'):
|
||||
used.add('extra-core-args')
|
||||
|
||||
args = self.get('extra-core-args').split()
|
||||
for arg in args: app.core_option_list.append([arg])
|
||||
|
||||
# Remaining options
|
||||
app.option_list.clear()
|
||||
for name, value in self.options.items():
|
||||
if name not in used:
|
||||
app.option_list.append([name, value])
|
||||
|
||||
|
||||
def update_status_slots(self, app):
|
||||
# Save selection
|
||||
selected = get_selected_tree_column(app.slot_status_tree, 0)
|
||||
if selected is not None: selected = selected
|
||||
selected_row = None
|
||||
log_filter_selected = get_active_combo_column(app.log_slot, 0)
|
||||
log_filter_row = None
|
||||
|
||||
# Clear list wo/ updating log filter
|
||||
self.updating = True
|
||||
try:
|
||||
app.slot_status_list.clear()
|
||||
finally:
|
||||
self.updating = False
|
||||
|
||||
# Reload list
|
||||
for slot in self.slots:
|
||||
id = '%02d' % slot.id
|
||||
status = slot.status.title()
|
||||
color = status_to_color(status)
|
||||
if status == 'Paused' and slot.reason:
|
||||
status += ':' + slot.reason
|
||||
status = get_span_markup(status, color)
|
||||
description = slot.description.replace('"', '')
|
||||
iter = app.slot_status_list.append((id, status, color, description))
|
||||
|
||||
if id == selected: selected_row = iter
|
||||
if id == log_filter_selected: log_filter_row = iter
|
||||
|
||||
# Selected the first item if nothing is selected
|
||||
if selected_row is None:
|
||||
selected_row = app.slot_status_list.get_iter_first()
|
||||
if log_filter_row is None:
|
||||
log_filter_row = app.slot_status_list.get_iter_first()
|
||||
|
||||
# Restore selections
|
||||
if selected_row is not None:
|
||||
app.slot_status_tree.get_selection().select_iter(selected_row)
|
||||
if log_filter_row is not None:
|
||||
app.log_slot.set_active_iter(log_filter_row)
|
||||
|
||||
|
||||
def update_slots_ui(self, app):
|
||||
app.slot_list.clear()
|
||||
for slot in self.slots:
|
||||
slot.add_to_ui(app)
|
||||
|
||||
|
||||
def scroll_log_to_end(self, app):
|
||||
if not app.log_follow.get_active(): return
|
||||
mark = app.log.get_mark('end')
|
||||
app.log.move_mark(mark, app.log.get_end_iter())
|
||||
app.log_view.scroll_mark_onscreen(mark)
|
||||
|
||||
|
||||
def log_clear(self, app):
|
||||
app.log.set_text('')
|
||||
self.log = []
|
||||
|
||||
|
||||
def log_filter_str(self, app):
|
||||
f = []
|
||||
|
||||
# Severity
|
||||
if app.log_severity.get_active():
|
||||
f.append(r'((WARNING)|(W )|(ERROR)|(E ))')
|
||||
|
||||
# Unit
|
||||
if app.log_unit_enable.get_active():
|
||||
id = get_active_combo_column(app.log_unit, 1)
|
||||
f.append(r'WU%s' % id)
|
||||
|
||||
# Slot
|
||||
if app.log_slot_enable.get_active():
|
||||
id = get_active_combo_column(app.log_slot, 0)
|
||||
f.append(r'FS%s' % id)
|
||||
|
||||
if len(f):
|
||||
f = map(lambda x: '.*(^|:)%s' % x, f)
|
||||
return '(^\*)|(%s):' % ''.join(f)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def log_filter(self, line):
|
||||
return self.log_filter_re is None or \
|
||||
self.log_filter_re.match(line) is not None
|
||||
|
||||
|
||||
def log_add_lines(self, app, lines):
|
||||
filtered = filter(self.log_filter, lines)
|
||||
|
||||
if len(filtered):
|
||||
text = '\n'.join(filtered)
|
||||
app.log.insert(app.log.get_end_iter(), text + '\n')
|
||||
self.scroll_log_to_end(app)
|
||||
|
||||
|
||||
def log_add(self, app, text):
|
||||
# TODO deal with split lines
|
||||
lines = []
|
||||
for line in text.split('\n'):
|
||||
if not line: continue
|
||||
lines.append(line)
|
||||
self.log.append(line)
|
||||
|
||||
self.log_add_lines(app, lines)
|
||||
|
||||
|
||||
def update_log(self, app):
|
||||
if self.updating: return # Don't refilter during updates
|
||||
|
||||
# Check if filter has changed
|
||||
log_filter = self.log_filter_str(app)
|
||||
if log_filter == self.last_log_filter: return
|
||||
|
||||
# Update filter
|
||||
self.last_log_filter = log_filter
|
||||
if log_filter is not None: self.log_filter_re = re.compile(log_filter)
|
||||
else: self.log_filter_re = None
|
||||
|
||||
# Reload log
|
||||
app.log.set_text('')
|
||||
self.log_add_lines(app, self.log)
|
||||
|
||||
|
||||
def update_status_ui(self, app):
|
||||
self.update_queue_ui(app)
|
||||
self.update_status_slots(app)
|
||||
self.update_work_unit_info(app)
|
||||
app.update_client_status() # TODO this should probably be moved here
|
||||
|
||||
|
||||
def reset_status_ui(self, app):
|
||||
self.reset_work_unit_info(app)
|
||||
app.queue_list.clear()
|
||||
app.slot_status_list.clear()
|
||||
app.log.set_text('')
|
||||
|
||||
|
||||
def get_running(self):
|
||||
for unit in self.queue:
|
||||
if unit['state'].upper() == 'RUNNING': return True
|
||||
return False
|
||||
|
||||
|
||||
def get_option_changes(self, app):
|
||||
used = set()
|
||||
options = {}
|
||||
|
||||
used.add('power') # Don't set power here
|
||||
|
||||
# Proxy options
|
||||
used.add('proxy')
|
||||
proxy_addr = get_widget_str_value(app.client_option_widgets['proxy'])
|
||||
proxy_port = get_widget_str_value(app.proxy_port)
|
||||
proxy = '%s:%s' % (proxy_addr, proxy_port)
|
||||
if self.get('proxy') != proxy: options['proxy'] = proxy
|
||||
|
||||
# Core priority radio button
|
||||
used.add('core-priority')
|
||||
if app.client_option_widgets['core_priority'].get_active():
|
||||
if self.have('core-priority') and \
|
||||
self.get('core-priority') != 'idle':
|
||||
options['core-priority'] = 'idle'
|
||||
elif self.get('core-priority') != 'low':
|
||||
options['core-priority'] = 'low'
|
||||
|
||||
# Extra core options
|
||||
used.add('extra-core-args')
|
||||
if self.have('extra-core-args'):
|
||||
old_args = self.get('extra-core-args').split()
|
||||
else: old_args = []
|
||||
|
||||
new_args = []
|
||||
def add_arg(model, path, iter, data):
|
||||
new_args.append(model.get(iter, 0)[0])
|
||||
app.core_option_list.foreach(add_arg, None)
|
||||
|
||||
if old_args != new_args:
|
||||
if new_args: options['extra-core-args'] = ' '.join(new_args)
|
||||
else: options['extra-core-args!'] = None
|
||||
|
||||
# Extra options
|
||||
def check_option(model, path, iter, data):
|
||||
name, value = model.get(iter, 0, 1)
|
||||
used.add(name)
|
||||
if self.get(name) != value: options[name] = value
|
||||
|
||||
app.option_list.foreach(check_option, None)
|
||||
|
||||
# Main options
|
||||
for name, widget in app.client_option_widgets.items():
|
||||
name = name.replace('_', '-')
|
||||
if name in used: continue
|
||||
value = self.get(name)
|
||||
used.add(name)
|
||||
|
||||
try:
|
||||
value = get_widget_str_value(widget)
|
||||
old_value = self.get(name)
|
||||
if value == '' and old_value is None: value = None
|
||||
if value != old_value:
|
||||
if value is None: options[name + '!'] = None
|
||||
else: options[name] = value
|
||||
|
||||
except Exception, e: # Don't let one bad widget kill everything
|
||||
print 'WARNING: failed to save widget "%s": %s' % (name, e)
|
||||
|
||||
# Removed options
|
||||
for name in self.options:
|
||||
if not name in used:
|
||||
options[name + '!'] = None
|
||||
|
||||
return options
|
||||
|
||||
|
||||
def get_slot_changes(self, app):
|
||||
# Get new slots
|
||||
new_slots = []
|
||||
def add_slot(model, path, iter, data = None):
|
||||
new_slots.append(model.get(iter, 2)[0].slot)
|
||||
app.slot_list.foreach(add_slot)
|
||||
|
||||
# Get old slot IDs
|
||||
old_slot_map = {}
|
||||
for slot in self.slots: old_slot_map[slot.id] = slot
|
||||
|
||||
# Get new slot IDs
|
||||
new_slot_ids = set()
|
||||
for slot in new_slots: new_slot_ids.add(slot.id)
|
||||
|
||||
# Find deleted slot IDs
|
||||
deleted = []
|
||||
for id in old_slot_map:
|
||||
if id not in new_slot_ids: deleted.append(id)
|
||||
|
||||
# Find added and modified slots
|
||||
added = []
|
||||
modified = []
|
||||
for slot in new_slots:
|
||||
# Added
|
||||
if slot.id == -1: added.append((slot.type, slot.options))
|
||||
else:
|
||||
old_slot = old_slot_map[slot.id]
|
||||
options = get_option_mods(old_slot.options, slot.options)
|
||||
if options or old_slot.type != slot.type:
|
||||
modified.append((slot.id, slot.type, options))
|
||||
|
||||
return (deleted, added, modified)
|
||||
|
||||
|
||||
def get_changes(self, app):
|
||||
return self.get_option_changes(app), self.get_slot_changes(app)
|
||||
|
||||
|
||||
def has_changes(self, app):
|
||||
options, slots = self.get_changes(app)
|
||||
return options or slots != ([], [], [])
|
280
fah/Connection.py
Executable file
@ -0,0 +1,280 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import socket
|
||||
import select
|
||||
import errno
|
||||
import time
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from fah.util import OrderedDict
|
||||
|
||||
if sys.platform == 'win32':
|
||||
from ctypes import windll
|
||||
WSAGetLastError = windll.ws2_32.WSAGetLastError
|
||||
|
||||
debug = False
|
||||
|
||||
|
||||
class Connection:
|
||||
def __init__(self, address = 'localhost', port = 36330, password = None,
|
||||
retry_rate = 5):
|
||||
self.address = address
|
||||
self.port = int(port)
|
||||
self.password = password
|
||||
self.init_commands = []
|
||||
self.retry_rate = retry_rate
|
||||
|
||||
self.socket = None
|
||||
self.reset()
|
||||
|
||||
|
||||
def set_init_commands(self, commands):
|
||||
self.init_commands = commands
|
||||
|
||||
if self.is_connected():
|
||||
map(self.queue_command, self.init_commands)
|
||||
|
||||
|
||||
def get_status(self):
|
||||
if self.connected: return 'Online'
|
||||
#if self.socket is None: return 'Offline'
|
||||
return 'Connecting'
|
||||
|
||||
|
||||
def is_connected(self):
|
||||
if self.socket is None: return False
|
||||
if self.connected: return True
|
||||
|
||||
rlist, wlist, xlist = select.select([], [self.socket], [self.socket], 0)
|
||||
|
||||
if len(wlist) != 0: self.connected = True
|
||||
elif len(xlist) != 0:
|
||||
self.fail_reason = 'refused'
|
||||
self.close()
|
||||
|
||||
return self.connected
|
||||
|
||||
|
||||
def can_write(self):
|
||||
rlist, wlist, xlist = select.select([], [self.socket], [], 0)
|
||||
return len(wlist) != 0
|
||||
|
||||
|
||||
def can_read(self):
|
||||
rlist, wlist, xlist = select.select([self.socket], [], [], 0)
|
||||
return len(rlist) != 0
|
||||
|
||||
|
||||
def reset(self):
|
||||
self.close()
|
||||
self.messages = []
|
||||
self.readBuf = ''
|
||||
self.writeBuf = ''
|
||||
self.fail_reason = None
|
||||
self.last_message = 0
|
||||
self.last_connect = 0
|
||||
|
||||
|
||||
def open(self):
|
||||
self.reset()
|
||||
self.last_connect = time.time()
|
||||
|
||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.socket.setblocking(0)
|
||||
err = self.socket.connect_ex((self.address, self.port))
|
||||
|
||||
if err != 0 and not err in [errno.EINPROGRESS, errno.EWOULDBLOCK]:
|
||||
self.fail_reason = 'connect'
|
||||
raise Exception, 'Connection failed: ' + errno.errorcode[err]
|
||||
|
||||
if self.password: self.queue_command('auth "%s"' % self.password)
|
||||
map(self.queue_command, self.init_commands)
|
||||
|
||||
|
||||
def close(self):
|
||||
if self.socket is not None:
|
||||
try:
|
||||
self.socket.shutdown(socket.SHUT_RDWR)
|
||||
except: pass
|
||||
try:
|
||||
self.socket.close()
|
||||
except: pass
|
||||
self.socket = None
|
||||
|
||||
self.connected = False
|
||||
|
||||
|
||||
def connection_lost(self):
|
||||
print 'Connection lost'
|
||||
self.close()
|
||||
self.fail_reason = 'closed'
|
||||
raise Exception, 'Lost connection'
|
||||
|
||||
|
||||
def connection_error(self, err, msg):
|
||||
print 'Connection Error: %d: %s' % (err, msg)
|
||||
self.close()
|
||||
if err == errno.ECONNREFUSED: self.fail_reason = 'refused'
|
||||
elif err in [errno.ETIMEDOUT, errno.ENETDOWN, errno.ENETUNREACH]:
|
||||
self.fail_reason = 'connect'
|
||||
else: self.fail_reason = 'error'
|
||||
|
||||
|
||||
def read_some(self):
|
||||
bytesRead = 0
|
||||
try:
|
||||
while True:
|
||||
buffer = self.socket.recv(10 * 1024 * 1024)
|
||||
if len(buffer):
|
||||
self.readBuf += buffer
|
||||
bytesRead += len(buffer)
|
||||
else:
|
||||
if bytesRead: return bytesRead
|
||||
self.connection_lost()
|
||||
return 0
|
||||
|
||||
except socket.error, (err, msg):
|
||||
# Error codes for nothing to read
|
||||
if err not in [errno.EAGAIN, errno.EWOULDBLOCK]:
|
||||
if bytesRead: return bytesRead
|
||||
self.connection_error(err, msg)
|
||||
raise
|
||||
|
||||
return bytesRead
|
||||
|
||||
|
||||
def write_some(self):
|
||||
if len(self.writeBuf) == 0: return 0
|
||||
|
||||
bytesWritten = 0
|
||||
try:
|
||||
while True:
|
||||
count = self.socket.send(self.writeBuf)
|
||||
if count:
|
||||
self.writeBuf = self.writeBuf[count:]
|
||||
bytesWritten += count
|
||||
else:
|
||||
if bytesWritten: return bytesWritten
|
||||
self.connection_lost()
|
||||
return 0
|
||||
|
||||
except socket.error, (err, msg):
|
||||
# Error codes for write buffer full
|
||||
if err not in [errno.EAGAIN, errno.EWOULDBLOCK]:
|
||||
if bytesWritten: return bytesWritten
|
||||
self.connection_error(err, msg)
|
||||
raise
|
||||
|
||||
return bytesWritten
|
||||
|
||||
|
||||
def queue_command(self, command):
|
||||
if debug: print 'command: ' + command
|
||||
self.writeBuf += command + '\n'
|
||||
|
||||
|
||||
def parse_message(self, version, type, data):
|
||||
try:
|
||||
msg = eval(data, {}, {})
|
||||
self.messages.append((version, type, msg))
|
||||
self.last_message = time.time()
|
||||
except Exception, e:
|
||||
print 'ERROR parsing PyON message: %s: %s' % (
|
||||
str(e), data.encode('string_escape'))
|
||||
|
||||
|
||||
def parse(self):
|
||||
start = self.readBuf.find('\nPyON ')
|
||||
if start != -1:
|
||||
eol = self.readBuf.find('\n', start + 1)
|
||||
if eol != -1:
|
||||
line = self.readBuf[start + 1: eol]
|
||||
tokens = line.split(None, 2)
|
||||
|
||||
if len(tokens) < 3:
|
||||
self.readBuf = self.readBuf[eol:]
|
||||
raise Exception, 'Invalid PyON line: ' + \
|
||||
line.encode('string_escape')
|
||||
|
||||
version = int(tokens[1])
|
||||
type = tokens[2]
|
||||
|
||||
end = self.readBuf.find('\n---\n', start)
|
||||
if end != -1:
|
||||
data = self.readBuf[eol + 1: end]
|
||||
self.parse_message(version, type, data)
|
||||
self.readBuf = self.readBuf[end + 4:]
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def update(self):
|
||||
try:
|
||||
try:
|
||||
if not self.is_connected():
|
||||
if self.socket is None:
|
||||
if self.last_connect + self.retry_rate < time.time():
|
||||
self.open()
|
||||
|
||||
elif self.last_connect + 60 < time.time():
|
||||
self.close() # Retry connect
|
||||
|
||||
if not self.is_connected(): return
|
||||
|
||||
self.write_some()
|
||||
if self.read_some():
|
||||
while self.parse(): continue
|
||||
|
||||
# Handle special case for OSX disconnect
|
||||
except socket.error, e:
|
||||
if sys.platform == 'darwin' and e.errno == errno.EPIPE:
|
||||
self.fail_reason = 'refused'
|
||||
self.close()
|
||||
|
||||
else: raise
|
||||
|
||||
except Exception, e:
|
||||
print 'ERROR on connection to %s:%d: %s' % (
|
||||
self.address, self.port, e)
|
||||
|
||||
# Timeout connection
|
||||
if self.connected and self.last_message and \
|
||||
self.last_message + 10 < time.time():
|
||||
print 'Connection timed out'
|
||||
self.close()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
init = ['updates add 0 1 $options',
|
||||
'updates add 1 1 $queue-info',
|
||||
'updates add 2 1 $slot-info']
|
||||
conn = Connection(init_commands = init)
|
||||
|
||||
while True:
|
||||
conn.update()
|
||||
|
||||
for version, type, data in conn.messages:
|
||||
print 'PyON %d %s:\n' % (version, type), data
|
||||
conn.messages = []
|
||||
|
||||
time.sleep(0.1)
|
7934
fah/FAHControl.glade
Normal file
1828
fah/FAHControl.py
Normal file
7074
fah/Icon.py
Normal file
118
fah/SlotConfig.py
Normal file
@ -0,0 +1,118 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import gtk
|
||||
import gobject
|
||||
import copy
|
||||
|
||||
from fah.util import parse_bool
|
||||
from fah.util import status_to_color
|
||||
|
||||
|
||||
class SlotConfig:
|
||||
def __init__(
|
||||
self, id = -1, status = None, description = None, reason = None,
|
||||
idle = False, options = {}, **kw):
|
||||
|
||||
self.id = int(id)
|
||||
self.status = status
|
||||
self.description = description
|
||||
self.reason = reason
|
||||
self.idle = idle
|
||||
self.options = options
|
||||
|
||||
if status is not None: self.status = status.title()
|
||||
if description is None: self.description = 'cpu'
|
||||
|
||||
# Type
|
||||
if self.description.startswith('cpu'): self.type = 'cpu'
|
||||
elif self.description.startswith('gpu'): self.type = 'gpu'
|
||||
else: raise Exception, 'Invalid slot type "%s"' % description
|
||||
|
||||
|
||||
def add_to_ui(self, app):
|
||||
wrapper = gobject.GObject()
|
||||
wrapper.slot = copy.deepcopy(self)
|
||||
app.slot_list.append((self.id, self.type, wrapper))
|
||||
|
||||
|
||||
@staticmethod
|
||||
def clear_dialog(app):
|
||||
app.slot_option_list.clear()
|
||||
app.slot_type_cpu.set_active(True)
|
||||
for name in 'gpu opencl cuda'.split():
|
||||
app.slot_option_widgets[name + '_index'].set_value(-1)
|
||||
app.slot_option_widgets['cpus'].set_value(-1)
|
||||
|
||||
|
||||
def save_dialog(self, app):
|
||||
self.options = {}
|
||||
|
||||
if app.slot_type_cpu.get_active():
|
||||
self.type = 'cpu'
|
||||
|
||||
cpus = str(int(app.slot_option_widgets['cpus'].get_value()))
|
||||
if int(cpus): self.options['cpus'] = cpus
|
||||
|
||||
elif app.slot_type_gpu.get_active():
|
||||
self.type = 'gpu'
|
||||
|
||||
for name in 'gpu opencl cuda'.split():
|
||||
idx = int(app.slot_option_widgets[name + '_index'].get_value())
|
||||
if idx == -1:
|
||||
if name + '-index' in self.options:
|
||||
del self.options[name + '-index']
|
||||
else: self.options[name + '-index'] = str(idx)
|
||||
|
||||
# Extra options
|
||||
def add_option(model, path, iter, data = None):
|
||||
name = model.get(iter, 0)[0]
|
||||
value = model.get(iter, 1)[0]
|
||||
self.options[name] = value
|
||||
|
||||
app.slot_option_list.foreach(add_option)
|
||||
|
||||
|
||||
def load_dialog(self, app):
|
||||
used = set()
|
||||
|
||||
# Type
|
||||
if self.type == 'cpu': app.slot_type_cpu.set_active(True)
|
||||
elif self.type == 'gpu': app.slot_type_gpu.set_active(True)
|
||||
else: raise Exception, 'Invalid slot type "%s"' % self.type
|
||||
used.add('gpu')
|
||||
|
||||
# SMP
|
||||
if 'cpus' in self.options: cpus = float(self.options['cpus'])
|
||||
else: cpus = -1
|
||||
app.slot_option_widgets['cpus'].set_value(cpus)
|
||||
used.add('cpus')
|
||||
|
||||
# GPU
|
||||
for name in 'gpu opencl cuda'.split():
|
||||
if name + '-index' in self.options:
|
||||
idx = float(self.options[name + '-index'])
|
||||
else: idx = -1
|
||||
app.slot_option_widgets[name + '_index'].set_value(idx)
|
||||
used.add(name + '-index')
|
||||
|
||||
# Options
|
||||
app.slot_option_list.clear()
|
||||
for name, value in self.options.items():
|
||||
if not name in used:
|
||||
app.slot_option_list.append((name, value))
|
1
fah/Version.py
Normal file
@ -0,0 +1 @@
|
||||
version = '7.4.4'
|
49
fah/WidgetMap.py
Normal file
@ -0,0 +1,49 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import gtk
|
||||
|
||||
|
||||
class WidgetMap(dict):
|
||||
def __init__(self, widgets, suffix = None, prefix = None):
|
||||
self.suffix = suffix
|
||||
self.prefix = prefix
|
||||
self.list = []
|
||||
|
||||
try:
|
||||
for widget in widgets: self.find(widget)
|
||||
except: self.find(widgets)
|
||||
|
||||
def add(self, widget):
|
||||
if widget is None: return
|
||||
name = gtk.Buildable.get_name(widget)
|
||||
|
||||
if self.suffix is not None: name = name[0:-len(self.suffix)]
|
||||
if self.prefix is not None: name = name[len(self.prefix):]
|
||||
self[name] = widget
|
||||
self.list.append(widget)
|
||||
|
||||
def find(self, widget):
|
||||
name = gtk.Buildable.get_name(widget)
|
||||
|
||||
if (name and (self.suffix is None or name.endswith(self.suffix)) and
|
||||
(self.prefix is None or name.startswith(self.prefix))):
|
||||
self.add(widget)
|
||||
|
||||
if isinstance(widget, gtk.Container):
|
||||
widget.foreach(self.find)
|
31
fah/__init__.py
Normal file
@ -0,0 +1,31 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
# fah
|
||||
|
||||
import db
|
||||
import util
|
||||
|
||||
from Version import *
|
||||
from Icon import *
|
||||
from SlotConfig import *
|
||||
from ClientConfig import *
|
||||
from Connection import *
|
||||
from Client import *
|
||||
from WidgetMap import *
|
||||
from FAHControl import *
|
46
fah/db/Column.py
Normal file
@ -0,0 +1,46 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
class Column:
|
||||
def __init__(self, name, dbType, constraits, auto = False):
|
||||
self.name = name
|
||||
self.dbType = dbType.lower()
|
||||
self.constraints = constraits
|
||||
self.auto = auto
|
||||
|
||||
|
||||
def get_name(self): return self.name
|
||||
def is_auto(self): return self.auto
|
||||
|
||||
|
||||
def get_db_value(self, value):
|
||||
if self.dbType == 'text': return "'%s'" % str(value).replace("'", "''")
|
||||
if self.dbType == 'integer': return '%d' % value
|
||||
if self.dbType == 'real': return '%f' % value
|
||||
if self.dbType == 'boolean':
|
||||
if value: return '1'
|
||||
else: return '0'
|
||||
|
||||
|
||||
def get_sql(self):
|
||||
return '"%s" %s %s' % (self.name, self.dbType, self.constraints)
|
||||
|
||||
|
||||
def __hash__(self): return self.name.__hash__()
|
||||
def __cmp__(self, other): return self.name.__cmp__(other.name)
|
||||
def __str__(self): return self.name
|
174
fah/db/Database.py
Normal file
@ -0,0 +1,174 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
from fah.db import Column, Table
|
||||
|
||||
import sqlite3
|
||||
|
||||
|
||||
class Database:
|
||||
tables = [
|
||||
Table('config',
|
||||
[
|
||||
Column('name', 'Text', 'NOT NULL'),
|
||||
Column('value', 'Text', 'NOT NULL'),
|
||||
],
|
||||
'PRIMARY KEY (name)'),
|
||||
|
||||
Table('clients',
|
||||
[
|
||||
Column('name', 'Text', 'NOT NULL'),
|
||||
Column('address', 'Text', 'NOT NULL'),
|
||||
Column('port', 'Integer', 'NOT NULL'),
|
||||
Column('password', 'Text', 'NOT NULL'),
|
||||
],
|
||||
'PRIMARY KEY (name)'),
|
||||
]
|
||||
|
||||
|
||||
def __init__(self, filename):
|
||||
self.filename = filename
|
||||
self.conn = sqlite3.connect(filename)
|
||||
self.conn.row_factory = sqlite3.Row
|
||||
self.queue = {}
|
||||
|
||||
|
||||
def get_table(self, name):
|
||||
for table in self.tables:
|
||||
if table.name == name: return table
|
||||
|
||||
raise Exception, 'Table "%s" not found' % name
|
||||
|
||||
|
||||
def get_version(self):
|
||||
return 6
|
||||
|
||||
|
||||
def get_current_version(self):
|
||||
return int(self.execute_one('PRAGMA user_version')[0])
|
||||
|
||||
|
||||
def set_current_version(self, version):
|
||||
self.write('PRAGMA user_version=%d' % version, True)
|
||||
|
||||
|
||||
def set(self, name, value, commit = True, queue = False):
|
||||
if queue: self.queue[name] = value
|
||||
else:
|
||||
self.insert('config', name = name, value = value)
|
||||
if commit: self.commit()
|
||||
|
||||
|
||||
def clear(self, name, commit = True):
|
||||
self.delete('config', name = name)
|
||||
if commit: self.commit()
|
||||
|
||||
|
||||
def get(self, name):
|
||||
c = self.get_table('config').select(self, 'value', name = name)
|
||||
result = c.fetchone()
|
||||
c.close()
|
||||
if result: return result[0]
|
||||
|
||||
|
||||
def has(self, name):
|
||||
return self.get(name) != None
|
||||
|
||||
|
||||
def default(self, name, default, commit = True):
|
||||
if not self.has(name): self.set(name, default, commit)
|
||||
|
||||
|
||||
def flush_queued(self):
|
||||
if len(self.queue) == 0: return
|
||||
|
||||
for name, value in self.queue.items():
|
||||
self.set(name, value, commit = False)
|
||||
|
||||
self.commit()
|
||||
self.queue.clear()
|
||||
|
||||
|
||||
def execute(self, sql):
|
||||
#print 'SQL:', sql
|
||||
c = self.conn.cursor()
|
||||
c.execute(sql)
|
||||
return c
|
||||
|
||||
|
||||
def execute_one(self, sql):
|
||||
c = self.execute(sql)
|
||||
result = c.fetchone()
|
||||
c.close()
|
||||
return result
|
||||
|
||||
|
||||
def write(self, sql, commit = False):
|
||||
self.execute(sql).close()
|
||||
if commit: self.commit()
|
||||
|
||||
|
||||
def commit(self):
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
def rollback(self):
|
||||
self.conn.rollback()
|
||||
|
||||
|
||||
def insert(self, table, **kwargs):
|
||||
self.get_table(table).insert(self, **kwargs)
|
||||
|
||||
|
||||
def delete(self, table, **kwargs):
|
||||
self.get_table(table).delete(self, **kwargs)
|
||||
|
||||
|
||||
def select(self, table, cols = None, **kwargs):
|
||||
return self.get_table(table).select(self, cols, **kwargs)
|
||||
|
||||
|
||||
def create(self):
|
||||
for table in self.tables:
|
||||
table.create(self)
|
||||
self.commit()
|
||||
|
||||
|
||||
def validate(self):
|
||||
current = self.get_current_version()
|
||||
if self.get_version() < current:
|
||||
raise Exception, \
|
||||
('Configuration database "%s" version %d is newer than is '
|
||||
'supported %d') % (self.filename, current, self.get_version())
|
||||
|
||||
elif self.get_version() != current:
|
||||
# Create or upgrade DB
|
||||
|
||||
if current == 0: self.create()
|
||||
else:
|
||||
if current <= 2:
|
||||
# Just drop and recreate the clients table
|
||||
self.execute('DROP TABLE IF EXISTS clients')
|
||||
for table in self.tables:
|
||||
if table.name == 'clients': table.create(self)
|
||||
|
||||
if current <= 5:
|
||||
self.execute('DROP TABLE IF EXISTS projects')
|
||||
|
||||
self.set_current_version(self.get_version())
|
||||
self.commit()
|
90
fah/db/Table.py
Normal file
@ -0,0 +1,90 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
from fah.db import Column
|
||||
|
||||
|
||||
class Table:
|
||||
def __init__(self, name, cols, constraints = ''):
|
||||
self.name = name
|
||||
self.cols = cols
|
||||
self.constraints = constraints
|
||||
|
||||
|
||||
def where(self, **kwargs):
|
||||
if len(kwargs) == 0: return ''
|
||||
sql = 'WHERE '
|
||||
|
||||
if len(kwargs) == 1 and 'where' in kwargs:
|
||||
sql += kwargs['where']
|
||||
|
||||
else:
|
||||
sql +=\
|
||||
' AND '.join(map(lambda i: '"%s"=\'%s\'' % i, kwargs.items()))
|
||||
|
||||
return sql
|
||||
|
||||
|
||||
def create(self, db):
|
||||
sql = 'CREATE TABLE IF NOT EXISTS "%s" (%s' % (
|
||||
self.name, ','.join(map(Column.get_sql, self.cols)))
|
||||
|
||||
if self.constraints: sql += ',%s' % self.constraints
|
||||
sql += ')'
|
||||
|
||||
db.execute(sql).close()
|
||||
|
||||
|
||||
def insert(self, db, **kwargs):
|
||||
cols = filter(lambda col: col.name in kwargs, self.cols)
|
||||
|
||||
# Error checking
|
||||
if len(cols) != len(kwargs):
|
||||
col_names = set(map(Column.get_name, cols))
|
||||
missing = filter(lambda kw: not kw in col_names, kwargs.keys())
|
||||
raise Exception, 'Table %s does not have column(s) %s' % (
|
||||
self.name, ', '.join(missing))
|
||||
|
||||
sql = 'REPLACE INTO "%s" ("%s") VALUES (%s)' % (
|
||||
self.name, '","'.join(map(Column.get_name, cols)),
|
||||
','.join(map(lambda col: col.get_db_value(kwargs[col.name]), cols)))
|
||||
|
||||
db.execute(sql).close()
|
||||
|
||||
|
||||
def select(self, db, cols = None, **kwargs):
|
||||
if cols is None:
|
||||
cols = '"' + '","'.join(map(str, self.cols)) + '"'
|
||||
|
||||
sql = 'SELECT %s FROM %s' % (cols, self.name)
|
||||
if 'orderby' in kwargs:
|
||||
sql += ' ORDER BY ' + kwargs['orderby']
|
||||
del kwargs['orderby']
|
||||
|
||||
sql += ' ' + self.where(**kwargs)
|
||||
|
||||
return db.execute(sql)
|
||||
|
||||
|
||||
def delete(self, db, **kwargs):
|
||||
sql = 'DELETE FROM %s %s' % (self.name, self.where(**kwargs))
|
||||
db.execute(sql).close()
|
||||
|
||||
|
||||
def drop(self, db):
|
||||
db.execute('DROP TABLE IF EXISTS ' + self.name).close()
|
23
fah/db/__init__.py
Normal file
@ -0,0 +1,23 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
# fah.db
|
||||
|
||||
from Column import *
|
||||
from Table import *
|
||||
from Database import *
|
50
fah/util/EntryValidator.py
Normal file
@ -0,0 +1,50 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import gtk
|
||||
import re
|
||||
|
||||
class EntryValidator:
|
||||
def __init__(self, app, entry, pattern, description = ''):
|
||||
self.app = app
|
||||
self.entry = entry
|
||||
self.re = re.compile(pattern)
|
||||
self.description = description
|
||||
self.text = entry.get_text()
|
||||
|
||||
entry.connect('focus-in-event', self.on_focus_in_event)
|
||||
entry.connect('focus-out-event', self.on_focus_out_event)
|
||||
|
||||
|
||||
def is_valid(self):
|
||||
return self.re.match(self.entry.get_text()) is not None
|
||||
|
||||
|
||||
def on_focus_in_event(self, widget, event, data = None):
|
||||
self.text = self.entry.get_text()
|
||||
return False # let the signal propagate
|
||||
|
||||
|
||||
def on_focus_out_event(self, widget, event, data = None):
|
||||
if not self.is_valid():
|
||||
self.app.error('Invalid value\n%s' % self.description)
|
||||
self.entry.set_text(self.text)
|
||||
|
||||
else: self.text = self.entry.get_text()
|
||||
|
||||
return False # let the signal propagate
|
118
fah/util/OrderedDict.py
Normal file
@ -0,0 +1,118 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
from UserDict import DictMixin
|
||||
|
||||
class OrderedDict(dict, DictMixin):
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
if len(args) > 1:
|
||||
raise TypeError('expected at most 1 arguments, got %d' % len(args))
|
||||
try:
|
||||
self.__end
|
||||
except AttributeError:
|
||||
self.clear()
|
||||
self.update(*args, **kwds)
|
||||
|
||||
def clear(self):
|
||||
self.__end = end = []
|
||||
end += [None, end, end] # sentinel node for doubly linked list
|
||||
self.__map = {} # key --> [key, prev, next]
|
||||
dict.clear(self)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if key not in self:
|
||||
end = self.__end
|
||||
curr = end[1]
|
||||
curr[2] = end[1] = self.__map[key] = [key, curr, end]
|
||||
dict.__setitem__(self, key, value)
|
||||
|
||||
def __delitem__(self, key):
|
||||
dict.__delitem__(self, key)
|
||||
key, prev, next = self.__map.pop(key)
|
||||
prev[2] = next
|
||||
next[1] = prev
|
||||
|
||||
def __iter__(self):
|
||||
end = self.__end
|
||||
curr = end[2]
|
||||
while curr is not end:
|
||||
yield curr[0]
|
||||
curr = curr[2]
|
||||
|
||||
def __reversed__(self):
|
||||
end = self.__end
|
||||
curr = end[1]
|
||||
while curr is not end:
|
||||
yield curr[0]
|
||||
curr = curr[1]
|
||||
|
||||
def popitem(self, last=True):
|
||||
if not self:
|
||||
raise KeyError('dictionary is empty')
|
||||
if last:
|
||||
key = reversed(self).next()
|
||||
else:
|
||||
key = iter(self).next()
|
||||
value = self.pop(key)
|
||||
return key, value
|
||||
|
||||
def __reduce__(self):
|
||||
items = [[k, self[k]] for k in self]
|
||||
tmp = self.__map, self.__end
|
||||
del self.__map, self.__end
|
||||
inst_dict = vars(self).copy()
|
||||
self.__map, self.__end = tmp
|
||||
if inst_dict:
|
||||
return (self.__class__, (items,), inst_dict)
|
||||
return self.__class__, (items,)
|
||||
|
||||
def keys(self):
|
||||
return list(self)
|
||||
|
||||
setdefault = DictMixin.setdefault
|
||||
update = DictMixin.update
|
||||
pop = DictMixin.pop
|
||||
values = DictMixin.values
|
||||
items = DictMixin.items
|
||||
iterkeys = DictMixin.iterkeys
|
||||
itervalues = DictMixin.itervalues
|
||||
iteritems = DictMixin.iteritems
|
||||
|
||||
def __repr__(self):
|
||||
if not self:
|
||||
return '%s()' % (self.__class__.__name__,)
|
||||
return '%s(%r)' % (self.__class__.__name__, self.items())
|
||||
|
||||
def copy(self):
|
||||
return self.__class__(self)
|
||||
|
||||
@classmethod
|
||||
def fromkeys(cls, iterable, value=None):
|
||||
d = cls()
|
||||
for key in iterable:
|
||||
d[key] = value
|
||||
return d
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, OrderedDict):
|
||||
return len(self)==len(other) and self.items() == other.items()
|
||||
return dict.__eq__(self, other)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
74
fah/util/PasswordValidator.py
Normal file
@ -0,0 +1,74 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import gtk
|
||||
|
||||
from fah.util.EntryValidator import EntryValidator
|
||||
|
||||
|
||||
class PasswordValidator(EntryValidator):
|
||||
def __init__(self, app, password_entry, reenter_entry, valid_image,
|
||||
valid_text, pattern = r'^.*$', description = ''):
|
||||
EntryValidator.__init__(self, app, password_entry, pattern, description)
|
||||
|
||||
self.password_entry = password_entry
|
||||
self.reenter_entry = reenter_entry
|
||||
self.valid_image = valid_image
|
||||
self.valid_text = valid_text
|
||||
|
||||
self.update()
|
||||
|
||||
password_entry.connect('changed', self.on_changed)
|
||||
reenter_entry.connect('changed', self.on_changed)
|
||||
|
||||
|
||||
def set_good(self):
|
||||
if not self.is_valid(): self.password_entry.set_text('')
|
||||
password = self.password_entry.get_text()
|
||||
self.reenter_entry.set_text(password)
|
||||
|
||||
|
||||
def is_good(self):
|
||||
return self.entries_match() and self.is_valid()
|
||||
|
||||
|
||||
def entries_match(self):
|
||||
password = self.password_entry.get_text()
|
||||
reenter = self.reenter_entry.get_text()
|
||||
return password == reenter
|
||||
|
||||
|
||||
def update(self):
|
||||
valid = False
|
||||
if self.is_valid():
|
||||
if self.entries_match(): valid = True
|
||||
else:
|
||||
self.valid_text.set_text('Entries do not match')
|
||||
else: self.valid_text.set_text('Entry is invalid')
|
||||
|
||||
if valid:
|
||||
self.valid_image.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON)
|
||||
self.valid_text.set_text('Entries match')
|
||||
else:
|
||||
self.valid_image.set_from_stock(gtk.STOCK_DIALOG_ERROR,
|
||||
gtk.ICON_SIZE_BUTTON)
|
||||
|
||||
|
||||
def on_changed(self, widget, data = None):
|
||||
self.update()
|
||||
return False # Let the signal propagate
|
81
fah/util/SingleApp.py
Normal file
@ -0,0 +1,81 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import sys
|
||||
import socket
|
||||
import threading
|
||||
import SocketServer
|
||||
|
||||
import gtk
|
||||
|
||||
from fah.Icon import get_icon
|
||||
|
||||
single_app_host = '127.0.0.1'
|
||||
single_app_port = 32455
|
||||
single_app_addr = (single_app_host, single_app_port)
|
||||
|
||||
|
||||
class SingleAppRequestHandler(SocketServer.BaseRequestHandler):
|
||||
def handle(self):
|
||||
cmd = self.request.recv(1024).strip()
|
||||
|
||||
if cmd == 'PING':
|
||||
self.server.ping.set()
|
||||
self.request.send('OK\r\n')
|
||||
|
||||
elif cmd == 'EXIT':
|
||||
self.server.exit_requested.set()
|
||||
self.request.send('OK\r\n')
|
||||
|
||||
|
||||
|
||||
class SingleAppServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
def __init__(self):
|
||||
# Check to see if we are already running
|
||||
self.check_for_instance()
|
||||
|
||||
self.ping = threading.Event()
|
||||
self.exit_requested = threading.Event()
|
||||
|
||||
SocketServer.TCPServer.__init__(
|
||||
self, single_app_addr, SingleAppRequestHandler)
|
||||
|
||||
thread = threading.Thread(target = self.serve_forever)
|
||||
# Exit the server thread when the main thread terminates
|
||||
thread.setDaemon(True)
|
||||
thread.start()
|
||||
|
||||
|
||||
def check_for_instance(self):
|
||||
sock = None
|
||||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect(single_app_addr)
|
||||
sock.send('PING')
|
||||
if sock.recv(1024).strip() == 'OK':
|
||||
print 'Already running'
|
||||
sys.exit(1)
|
||||
|
||||
except socket.error:
|
||||
# Assume this is the first instance
|
||||
return
|
||||
|
||||
finally:
|
||||
if sock is not None: sock.close()
|
203
fah/util/__init__.py
Normal file
@ -0,0 +1,203 @@
|
||||
'''
|
||||
Folding@Home Client Control (FAHControl)
|
||||
Copyright (C) 2010-2014 Stanford University
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
# fah.util
|
||||
import sys
|
||||
import os
|
||||
import gtk
|
||||
|
||||
from SingleApp import *
|
||||
from EntryValidator import *
|
||||
from PasswordValidator import *
|
||||
from OrderedDict import *
|
||||
|
||||
|
||||
def parse_bool(x):
|
||||
if isinstance(x, bool): return x
|
||||
return x.lower() in ['true', 't', '1', 'yes', 'y']
|
||||
|
||||
|
||||
def status_to_color(status):
|
||||
status = status.upper()
|
||||
|
||||
if status == 'PAUSED' or status == 'UPDATING':
|
||||
return '#ffff55'
|
||||
elif status == 'FINISHED' or status == 'OFFLINE' or status == 'UPLOADED':
|
||||
return '#0080c0'
|
||||
elif status == 'RUNNING' or status == 'ACTIVE' or status == 'ONLINE':
|
||||
return '#1dd923'
|
||||
elif status == 'FINISHING':
|
||||
return '#7AD980'
|
||||
elif status == 'FAILED' or status == 'ERROR' or status == 'FAULTY':
|
||||
return '#ff0000'
|
||||
elif status == 'SHUTDOWN' or status == 'CONNECTING':
|
||||
return '#ff8b00'
|
||||
elif status == 'OFFLINE':
|
||||
return '#dddddd'
|
||||
elif status == 'READY':
|
||||
return '#1ef0bc'
|
||||
elif status == 'DUMP':
|
||||
return '#d2c272'
|
||||
else: return None
|
||||
|
||||
|
||||
def get_span_markup(text, bg = None, fg = 'black'):
|
||||
markup = '<span'
|
||||
if bg is not None: markup += ' background="%s"' % bg
|
||||
if fg is not None: markup += ' foreground="%s"' % fg
|
||||
markup += '>%s</span>' % text
|
||||
return markup
|
||||
|
||||
|
||||
def iterate_container(widget):
|
||||
yield widget
|
||||
|
||||
if isinstance(widget, gtk.Container):
|
||||
for child in widget.get_children():
|
||||
for x in iterate_container(child): yield x
|
||||
|
||||
|
||||
def make_row(cols, keys):
|
||||
for col in cols:
|
||||
if col in keys: yield keys[col]
|
||||
else: yield ''
|
||||
|
||||
|
||||
def get_combo_items(widget):
|
||||
items = []
|
||||
def iterate_list(model, path, iter, data = None):
|
||||
items.append(model.get_value(iter, 0))
|
||||
|
||||
widget.get_model().foreach(iterate_list, None)
|
||||
|
||||
return items
|
||||
|
||||
|
||||
def get_widget_str_value(widget):
|
||||
if isinstance(widget, (gtk.SpinButton, gtk.Range)):
|
||||
# Must come before gtk.Entry for gtk.SpinButton
|
||||
|
||||
# Clean up float formatting
|
||||
value = '%.2f' % widget.get_value()
|
||||
if value.endswith('.00'): value = value[0:-3]
|
||||
elif value.endswith('.0'): value = value[0:-2]
|
||||
return value
|
||||
|
||||
elif isinstance(widget, gtk.Entry): return widget.get_text()
|
||||
|
||||
elif isinstance(widget, gtk.RadioButton):
|
||||
# TODO interpret as a number? or name?
|
||||
pass
|
||||
|
||||
elif isinstance(widget, gtk.ToggleButton):
|
||||
if widget.get_active(): return 'true'
|
||||
else: return 'false'
|
||||
|
||||
elif isinstance(widget, gtk.ComboBox):
|
||||
# NOTE This does not always get the displayed text
|
||||
return widget.get_active_text()
|
||||
|
||||
else:
|
||||
print 'ERROR: unsupported widget type %s' % type(widget)
|
||||
|
||||
|
||||
def set_widget_str_value(widget, value):
|
||||
if value is None: value = ''
|
||||
value = str(value)
|
||||
|
||||
if isinstance(widget, (gtk.SpinButton, gtk.Range)):
|
||||
# Must come before gtk.Entry for gtk.SpinButton
|
||||
if value == '': value = 0
|
||||
else:
|
||||
try: value = float(value)
|
||||
except: value = 0
|
||||
widget.set_value(value)
|
||||
|
||||
elif isinstance(widget, (gtk.Entry, gtk.Label)):
|
||||
if widget.get_text() != value: widget.set_text(value)
|
||||
elif isinstance(widget, gtk.RadioButton): pass # Ignore for now
|
||||
elif isinstance(widget, gtk.ToggleButton):
|
||||
widget.set_active(parse_bool(value))
|
||||
elif isinstance(widget, gtk.Button):
|
||||
# NOTE: For some reason setting Button labels causes tooltips to hide.
|
||||
# Only set when it has actually changed.
|
||||
if widget.get_label() != value:
|
||||
widget.set_label(value)
|
||||
|
||||
elif isinstance(widget, gtk.ComboBox):
|
||||
items = get_combo_items(widget)
|
||||
length = len(items)
|
||||
for i in range(length):
|
||||
if items[i].lower() == value.lower():
|
||||
widget.set_active(i)
|
||||
return
|
||||
|
||||
print 'ERROR: Invalid value "%s"' % value
|
||||
|
||||
elif isinstance(widget, gtk.ProgressBar):
|
||||
widget.set_text(value)
|
||||
|
||||
if value == '': value = '0'
|
||||
|
||||
if value.endswith('%'): fraction = float(value[:-1]) / 100.0
|
||||
else: fraction = float(value)
|
||||
|
||||
widget.set_fraction(fraction)
|
||||
|
||||
else:
|
||||
print 'ERROR: unsupported option widget type %s' % type(widget)
|
||||
|
||||
|
||||
def set_widget_change_action(widget, action):
|
||||
if isinstance(widget, (gtk.Editable, gtk.ComboBox)):
|
||||
widget.connect('changed', action)
|
||||
|
||||
elif isinstance(widget, gtk.Range):
|
||||
widget.connect('value_changed', action)
|
||||
|
||||
elif isinstance(widget, gtk.ToggleButton):
|
||||
widget.connect('toggled', action)
|
||||
|
||||
elif isinstance(widget, gtk.TreeModel):
|
||||
widget.connect('row_changed', action)
|
||||
widget.connect('row_inserted', action)
|
||||
widget.connect('row_deleted', action)
|
||||
widget.connect('rows_reordered', action)
|
||||
|
||||
else:
|
||||
print 'ERROR: unsupported option widget type %s' % type(widget)
|
||||
|
||||
|
||||
def get_home_dir():
|
||||
if sys.platform == 'win32': return '.'
|
||||
|
||||
path = os.path.expanduser("~")
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
path = os.path.join(path, 'Library/Application Support/FAHClient')
|
||||
|
||||
else: path = os.path.join(path, '.FAHClient')
|
||||
|
||||
if not os.path.exists(path): os.makedirs(path)
|
||||
|
||||
return path
|
||||
|
||||
|
||||
def get_theme_dirs():
|
||||
return [get_home_dir() + '/themes', gtk.rc_get_theme_dir(),
|
||||
'/usr/share/themes']
|
49
fah/wraplabel.py
Normal file
@ -0,0 +1,49 @@
|
||||
import gtk
|
||||
import gobject
|
||||
import pango
|
||||
|
||||
|
||||
class WrapLabel(gtk.Label):
|
||||
__gtype_name__ = 'WrapLabel'
|
||||
|
||||
def __init__(self, str = None):
|
||||
gtk.Label.__init__(self)
|
||||
|
||||
self.__wrap_width = 0
|
||||
self.layout = self.get_layout()
|
||||
self.layout.set_wrap(pango.WRAP_WORD_CHAR)
|
||||
|
||||
if str != None: self.set_text(str)
|
||||
|
||||
self.set_alignment(0, 0)
|
||||
|
||||
|
||||
def do_size_request(self, requisition):
|
||||
layout = self.get_layout()
|
||||
width, height = layout.get_pixel_size()
|
||||
requisition.width = 0
|
||||
requisition.height = height
|
||||
|
||||
|
||||
def do_size_allocate(self, allocation):
|
||||
gtk.Label.do_size_allocate(self, allocation)
|
||||
self.__set_wrap_width(allocation.width)
|
||||
|
||||
|
||||
def set_text(self, str):
|
||||
gtk.Label.set_text(self, str)
|
||||
self.__set_wrap_width(self.__wrap_width)
|
||||
|
||||
|
||||
def set_markup(self, str):
|
||||
gtk.Label.set_markup(self, str)
|
||||
self.__set_wrap_width(self.__wrap_width)
|
||||
|
||||
|
||||
def __set_wrap_width(self, width):
|
||||
if width == 0: return
|
||||
layout = self.get_layout()
|
||||
layout.set_width(width * pango.SCALE)
|
||||
if self.__wrap_width != width:
|
||||
self.__wrap_width = width
|
||||
self.queue_resize()
|
BIN
images/FAHControl.icns
Normal file
BIN
images/FAHControl.ico
Normal file
After Width: | Height: | Size: 96 KiB |
BIN
images/FAHControl.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
41
osx/scripts/onquit
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" != "--delayed-action" ]; then
|
||||
"$0" --delayed-action "$@" &
|
||||
exit 0
|
||||
fi
|
||||
|
||||
shift
|
||||
|
||||
# Wait up to 1 minute for Installer.app to quit
|
||||
I=0
|
||||
while $(ps axww|grep -v grep|grep Installer.app >/dev/null 2>&1); do
|
||||
sleep 1
|
||||
let I+=1
|
||||
if [ $I -ge 60 ]; then break; fi
|
||||
done
|
||||
|
||||
if [ $I -lt 1 ]; then sleep 1; fi
|
||||
|
||||
# move app if it was relocated to old place
|
||||
# move must delayed becuase installd will try to register app in installed
|
||||
# location after all scripts have been run, although it seems to just be a
|
||||
# harmless error message in installer log
|
||||
A1="/Applications/FAHControl.app"
|
||||
A2="/Applications/Folding@home/FAHControl.app"
|
||||
if [ -d "$A1" ]; then
|
||||
if [ ! -d "$A2" ]; then
|
||||
mv "$A1" "$A2"
|
||||
else
|
||||
# app was not relocated; delete old one (should only happen on 10.5)
|
||||
rm -rf "$A1"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ensure no old group writeable in std install locations
|
||||
# (installer overwrite will not change directory permissions)
|
||||
if [ -d "$A1" ]; then chmod -R go-w "$A1"; fi
|
||||
if [ -d "$A2" ]; then chmod -R go-w "$A2"; fi
|
||||
|
||||
# do action
|
||||
#"$@"
|
13
osx/scripts/postflight
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# fahcontrol postflight/postinstall
|
||||
|
||||
D="/Applications/Folding@home"
|
||||
if [ -d "$D" ]; then
|
||||
chmod 0755 "$D"
|
||||
else
|
||||
mkdir -m 0755 "$D"
|
||||
fi
|
||||
|
||||
SCRIPTS="$(dirname "$0")"
|
||||
"$SCRIPTS"/onquit
|
118
setup.py
Normal file
@ -0,0 +1,118 @@
|
||||
import sys
|
||||
import os
|
||||
import inspect
|
||||
|
||||
dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
|
||||
if dir == '': dir = '.'
|
||||
print 'dir =', dir
|
||||
|
||||
os.chdir(dir)
|
||||
|
||||
# Convert glade data
|
||||
in_file = 'fah/FAHControl.glade'
|
||||
out_file = 'fah/FAHControl_glade.py'
|
||||
input = None
|
||||
output = None
|
||||
try:
|
||||
input = open(in_file, 'r')
|
||||
output = open(out_file, 'w')
|
||||
|
||||
output.write('# -*- coding: utf8 -*-\n\n')
|
||||
output.write('glade_data = """')
|
||||
output.write(input.read())
|
||||
output.write('"""\n')
|
||||
finally:
|
||||
if input is not None: input.close()
|
||||
if output is not None: output.close()
|
||||
|
||||
|
||||
# Bootstrap
|
||||
try:
|
||||
import ez_setup
|
||||
ez_setup.use_setuptools()
|
||||
except: pass
|
||||
|
||||
app = 'FAHControl'
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
from setuptools import setup
|
||||
|
||||
plist = dict(
|
||||
CFBundleDisplayName = 'FAHControl',
|
||||
CFBundleIdentifier = 'edu.stanford.folding.fahcontrol',
|
||||
CFBundleSignature = '????',
|
||||
NSHumanReadableCopyright = 'Copyright 2010-2014 Stanford University',
|
||||
)
|
||||
|
||||
options = dict(
|
||||
argv_emulation = False,
|
||||
includes = 'cairo, pango, pangocairo, atk, gobject, gio',
|
||||
iconfile = 'images/FAHControl.icns',
|
||||
resources = ['/opt/local/share/themes'],
|
||||
plist = plist,
|
||||
)
|
||||
|
||||
extra_opts = dict(
|
||||
app = [app],
|
||||
options = {'py2app': options},
|
||||
setup_requires = ['py2app'],
|
||||
)
|
||||
|
||||
# Hack around py2app problem with python scripts with out .py extension.
|
||||
from py2app.util import PY_SUFFIXES
|
||||
PY_SUFFIXES.append('')
|
||||
|
||||
elif sys.platform == 'win32':
|
||||
from cx_Freeze import setup, Executable
|
||||
|
||||
e = Executable(app, base = 'Win32GUI', icon = 'images/FAHControl.ico')
|
||||
options = {'build_exe': {'build_exe': 'gui'}}
|
||||
extra_opts = dict(executables = [e], options = options)
|
||||
|
||||
else:
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
extra_opts = dict(
|
||||
packages = find_packages(),
|
||||
scripts = [app],
|
||||
data_files = [('/usr/share/pixmaps', ['images/FAHControl.png'])],
|
||||
install_requires = 'gtk2 >= 2.14.0',
|
||||
)
|
||||
|
||||
try:
|
||||
version = open('version/version.txt').read().strip()
|
||||
except: version = None
|
||||
|
||||
if version is not None:
|
||||
open('fah/Version.py', 'w').write('version = \'%s\'\n' % version)
|
||||
|
||||
description = \
|
||||
'''Folding@home is a distributed computing project using volunteered
|
||||
computer resources run by Pandegroup of Stanford University.
|
||||
'''
|
||||
short_description = '''
|
||||
This package contains FAHControl, a graphical monitor and control
|
||||
utility for the Folding@home client. It gives an overview of running
|
||||
projects on the local and optional (remote) machines. Starting,
|
||||
stopping and pausing of the running projects is also possible, as is
|
||||
viewing the logs. It provides an Advanced view with
|
||||
additional information and settings for enthusiasts and gurus.'''
|
||||
|
||||
description += short_description
|
||||
|
||||
setup(
|
||||
name = 'FAHControl',
|
||||
version = version,
|
||||
description = 'Folding@home Client Control',
|
||||
long_description = description,
|
||||
author = 'Joseph Coffland',
|
||||
author_email = 'joseph@cauldrondevelopment.com',
|
||||
license = 'GNU General Public License version 3',
|
||||
keywords = 'protein, molecular dynamics, simulation',
|
||||
url = 'http://folding.stanford.edu/',
|
||||
package_data = {'fah': ['*.glade']},
|
||||
**extra_opts)
|
||||
|
||||
with open('package-description.txt', 'w') as f:
|
||||
f.write(short_description.strip())
|
||||
|
9
stdeb.cfg
Normal file
@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
Package: fahcontrol
|
||||
Debian-Version: 1
|
||||
Recommends: fahclient, fahviewer
|
||||
Section: science
|
||||
Priority: optional
|
||||
MIME-Desktop-Files: FAHControl.desktop
|
||||
Depends: python-gnome2
|
||||
XS-Python-Version: >= 2.4
|
BIN
theme-engines/gtk-2.0/2.10.0/engines/libanachron.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libaurora.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libbluecurve.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libblueprint.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libcandido.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libcleanice.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libclearlooks.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libcrux-engine.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libdyndyn.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libexcelsior.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libgflat.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libglide.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libhcengine.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libindustrial.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/liblighthouseblue.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libmetal.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libmgicchikn.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libmist.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libmurrine.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libnimbus.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libnodoka.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libpixmap.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libredmond95.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/librezlooks.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libsmooth.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libthinice.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libubuntulooks.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libwimp.dll
Executable file
BIN
theme-engines/gtk-2.0/2.10.0/engines/libxfce.dll
Executable file
340
themes/Aero-Ion/LICENSE
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
25
themes/Aero-Ion/gtk-2.0/NEWS
Normal file
@ -0,0 +1,25 @@
|
||||
Aero-ion-GTK-2.x 3.1
|
||||
* Nicer checkbuttons, radio options, background, various other small items.
|
||||
-- David Gowers <00ai99@gmail.com>
|
||||
|
||||
Aero-GTK-2.x 1.2
|
||||
|
||||
* gtk-stop icon has been changed
|
||||
* GtkDialog and GtkMenubar don't have the highlight on top
|
||||
anymore, because this is painted by the Metacity theme now.
|
||||
|
||||
Aero-GTK-2.x 1.1
|
||||
|
||||
* Wire frame borders are anti-aliased now.
|
||||
* The active notebook tab is distincter now.
|
||||
* 61 stock icons have been themed (11 of them in two sizes).
|
||||
* The background image of windows and dialogs has been changed.
|
||||
* The font color has been brightened somewhat for better contrast.
|
||||
* An explanation of how to change Nautilus' icon title color to
|
||||
something readable, has been added to the README.
|
||||
|
||||
Aero-GTK-2.x 1.0
|
||||
|
||||
* Initial release.
|
||||
|
||||
Marcus Petzoldt <m.petzoldt@gmx.de>
|
38
themes/Aero-Ion/gtk-2.0/README
Normal file
@ -0,0 +1,38 @@
|
||||
This is Aero-ion a theme for GTK 2.x. It is an inverse Aqua-style theme, in
|
||||
which the gas phase and the liquid phase have been switched.
|
||||
|
||||
The 'Aero-ion' version (versus plain 'Aero') is modified to be much more
|
||||
practical (background is plain instead of checked for most things,
|
||||
and checkbuttons and radio options were improved to be both more legible
|
||||
and more sensible.).
|
||||
|
||||
The most recent version of Aero-ion can be found at art.gnome.org
|
||||
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
|
||||
Just unpack into your ~/.themes directory and use gconf-editor to switch
|
||||
theme.
|
||||
|
||||
Unfortunately Nautilus seems to disrespect Aero theme settings, when
|
||||
using the icon view. This can be solved by creating a new background
|
||||
color (color value is #37383F), and drag it onto the icon view pane.
|
||||
Nautilus automagically switches the icon title color to white.
|
||||
|
||||
Create a new background color (from the Nautilus online help file):
|
||||
|
||||
To add a color to the colors that you can use on your screen components,
|
||||
choose Edit-> Backgrounds and Emblems. Click on the Colors button, then
|
||||
click on the Add New Color button. A color selector dialog is displayed.
|
||||
Use the color wheel or the sliders to choose the color (enter #37383F
|
||||
here). Click OK to add the new color to the Backgrounds and Emblems
|
||||
dialog.
|
||||
|
||||
AUTHOR(s)
|
||||
---------
|
||||
This theme was brought to you by:
|
||||
Marcus Petzoldt <m.petzoldt@gmx.de>
|
||||
|
||||
'ion' version by:
|
||||
David Gowers <00ai99@gmail.com>
|
BIN
themes/Aero-Ion/gtk-2.0/arrow-down-i.png
Normal file
After Width: | Height: | Size: 164 B |
BIN
themes/Aero-Ion/gtk-2.0/arrow-down.png
Normal file
After Width: | Height: | Size: 167 B |
BIN
themes/Aero-Ion/gtk-2.0/arrow-left-i.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
themes/Aero-Ion/gtk-2.0/arrow-left.png
Normal file
After Width: | Height: | Size: 163 B |
BIN
themes/Aero-Ion/gtk-2.0/arrow-right-i.png
Normal file
After Width: | Height: | Size: 181 B |
BIN
themes/Aero-Ion/gtk-2.0/arrow-right.png
Normal file
After Width: | Height: | Size: 161 B |
BIN
themes/Aero-Ion/gtk-2.0/arrow-up-i.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
themes/Aero-Ion/gtk-2.0/arrow-up.png
Normal file
After Width: | Height: | Size: 159 B |
BIN
themes/Aero-Ion/gtk-2.0/bg.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
themes/Aero-Ion/gtk-2.0/box.png
Normal file
After Width: | Height: | Size: 253 B |
BIN
themes/Aero-Ion/gtk-2.0/button-default.png
Normal file
After Width: | Height: | Size: 642 B |
BIN
themes/Aero-Ion/gtk-2.0/button-in-pre.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
themes/Aero-Ion/gtk-2.0/button-in.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
themes/Aero-Ion/gtk-2.0/button-out-pre.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
themes/Aero-Ion/gtk-2.0/button-out.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
themes/Aero-Ion/gtk-2.0/check1.png
Normal file
After Width: | Height: | Size: 295 B |
BIN
themes/Aero-Ion/gtk-2.0/check2.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
themes/Aero-Ion/gtk-2.0/check3.png
Normal file
After Width: | Height: | Size: 458 B |
BIN
themes/Aero-Ion/gtk-2.0/check4.png
Normal file
After Width: | Height: | Size: 494 B |
BIN
themes/Aero-Ion/gtk-2.0/check5.png
Normal file
After Width: | Height: | Size: 387 B |
BIN
themes/Aero-Ion/gtk-2.0/check6.png
Normal file
After Width: | Height: | Size: 307 B |
BIN
themes/Aero-Ion/gtk-2.0/check7.png
Normal file
After Width: | Height: | Size: 354 B |
BIN
themes/Aero-Ion/gtk-2.0/check8.png
Normal file
After Width: | Height: | Size: 326 B |
BIN
themes/Aero-Ion/gtk-2.0/entry-insensitive.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
themes/Aero-Ion/gtk-2.0/entry-normal.png
Normal file
After Width: | Height: | Size: 128 B |
BIN
themes/Aero-Ion/gtk-2.0/ext-bottom-active.png
Normal file
After Width: | Height: | Size: 566 B |
BIN
themes/Aero-Ion/gtk-2.0/ext-bottom1.png
Normal file
After Width: | Height: | Size: 754 B |
BIN
themes/Aero-Ion/gtk-2.0/ext-left.png
Normal file
After Width: | Height: | Size: 747 B |
BIN
themes/Aero-Ion/gtk-2.0/ext-right.png
Normal file
After Width: | Height: | Size: 754 B |
BIN
themes/Aero-Ion/gtk-2.0/ext-top-active.png
Normal file
After Width: | Height: | Size: 681 B |
BIN
themes/Aero-Ion/gtk-2.0/ext-top.png
Normal file
After Width: | Height: | Size: 581 B |