Hi, Fred L. Drake, Jr. : > > Skip Montanaro writes: > > I'm running kde. From bash I see an environment variable named KDEDIR whose > > value is "/usr". Would that be a possible extra test to assure that kde is > > running before deciding to launch kfm? Clever idea, Skip! This will also work on SuSE Linux, where I have KDEDIR=/opt/kde > Sounds good! How about this for the non-MacOS portion of the > default-browser determination: > > DEFAULT_BROWSER = "command-line" > > if sys.platform[:3] == "win": > del _browsers["kfm"] > register("windows-default", WindowsDefault) > DEFAULT_BROWSER = "windows-default" > elif os.environ.get("DISPLAY"): > if os.environ.get("KDEDIR"): > DEFAULT_BROWSER = "kfm" > elif _iscommand("netscape"): > DEFAULT_BROWSER = "netscape" I believe there might be some people using KDE on a luxury computer (like the rolls royce alike that Fred has) and because they don't have to bother about RAM usage, they still may want to use Netscape as their default browser under KDE. I muust admit that Netscape provides more features and nice bookmark handling, although the differences might become smaller with KDE 2.x. That however again will burn more RAM. :-( Testing for available RAM will only work on Linux on the other hand, because most other unices lack '/proc/meminfo'. Using something more portable like the famous 'wc -c /dev/mem' unix tool abuse hack will not work due to the obvious lack of read permissions on /dev/mem for simple user processes. Adding the proposed AI (heuristic, hack, rule-of-thumb whatever you want to call it) to choose the default browser dependent on the amount of installed RAM is quite unpythonic, or what? However it is so simple, since Linux and Python are really powerful here: def small_ram(): """returns True on machines with less than 128 MB Ram""" import string, __builtin__ memtotal = long(string.split( __builtin__.open("/proc/meminfo").readlines()[1])[1]) return memtotal < 128L * 1024 * 1024 # less than 128 MB May be the best solution would be to test if any of the _browsers, which support a remote protocol is already running and only fire up a new browser, if no browser process can be identified. This however will break the current class hierarchy. So this should be delayed until Python 2.1? Finally: I like your proposed solution. Regards, Peter
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4