[Pymoul-svn] SF.net SVN: pymoul: [147] pymoul/trunk/src/moul
Status: Alpha
Brought to you by:
tiran
|
From: <ti...@us...> - 2007-02-06 16:48:49
|
Revision: 147
http://pymoul.svn.sourceforge.net/pymoul/?rev=147&view=rev
Author: tiran
Date: 2007-02-06 08:48:27 -0800 (Tue, 06 Feb 2007)
Log Message:
-----------
Fixed import errors
Fixed already running msg
Modified Paths:
--------------
pymoul/trunk/src/moul/file/chatlog.py
pymoul/trunk/src/moul/qt/i18n/__init__.py
pymoul/trunk/src/moul/qt/mainwindow.py
pymoul/trunk/src/moul/qt/moulqt.py
Property Changed:
----------------
pymoul/trunk/src/moul/qt/i18n/__init__.py
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-02-06 15:58:25 UTC (rev 146)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-02-06 16:48:27 UTC (rev 147)
@@ -73,9 +73,6 @@
r"(?P<ch>\d{2})(?P<cm>\d{2})_(?P<sh>\d{2})(?P<sm>\d{2})\.txt", # hhmm_hhmm.txt
RE_FLAGS
)
-#CHATLOG_FNAME_RE = re.compile(
-# r"[cC]hat.*\.log", # chat*.log
-# RE_FLAGS)
LOG = getLogger('moul.chat')
@@ -203,9 +200,16 @@
def __init__(self, logdir):
self._logdir = logdir
self._logfiles = [] # list of ChatlogViews
+ self.refresh()
- if not os.path.isdir(logdir):
+ def refresh(self):
+ """Refresh list
+ """
+ # TODO: inefficient, compare list with directory content
+ if not os.path.isdir(self._logdir):
LOG.warning("%s is not a directory" % logdir)
+ return
+ self._logfiles[:] = []
self._findChatlogs()
def _findChatlogs(self):
@@ -218,10 +222,12 @@
chatlog = ChatlogView(fname)
if chatlog.date is not None:
self._logfiles.append(chatlog)
+ self._logfiles.sort(key=lambda element:(element.date, element.name))
- @property
- def names(self):
- return [clv.name for clv in self]
+ def __len__(self):
+ """len() support
+ """
+ return len(self._logfiles)
def __iter__(self):
return iter(self._logfiles)
@@ -281,8 +287,8 @@
def view(self):
"""View the file
- Returns an iterator which iterates over the lines of the file
+ @return: file content
+ @rtype: str
"""
self.open()
- # TODO: add parser, currently simply iterates over the file
- return iter(self._fd)
+ self._fd.read()
Modified: pymoul/trunk/src/moul/qt/i18n/__init__.py
===================================================================
--- pymoul/trunk/src/moul/qt/i18n/__init__.py 2007-02-06 15:58:25 UTC (rev 146)
+++ pymoul/trunk/src/moul/qt/i18n/__init__.py 2007-02-06 16:48:27 UTC (rev 147)
@@ -20,8 +20,8 @@
moul.qt.i18n
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: __init__.py 108 2007-01-31 14:46:54Z tiran $"
-__revision__ = "$Revision: 108 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
import sys
Property changes on: pymoul/trunk/src/moul/qt/i18n/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/qt/mainwindow.py
===================================================================
--- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-06 15:58:25 UTC (rev 146)
+++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-06 16:48:27 UTC (rev 147)
@@ -24,12 +24,13 @@
__version__ = "$Id$"
__revision__ = "$Revision$"
-import sys
+import os
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4.QtCore import Qt
from PyQt4.QtCore import SIGNAL
from PyQt4.QtCore import pyqtSignature
+import sys
from moul import metadata
from moul.config import lookupDir
@@ -96,32 +97,6 @@
self.on_moulIsRunning)
self._moulrunning_thread.startChecker(5.0) # check now and every 5 seconds
- about = self.trUtf8("""
-<center>
-<h3>Tool for Myst Online : Uru Live</h3>
-
-<p>(c) 2007 Christian Heimes</p>
-
-<p><a href="http://pymoul.sourceforge.net">http://pymoul.sourceforge.net</a></p>
-</center>
-
-<h4>Bug reporting</h4>
-<p align="justify">If you encountered a bug please <a href="http://sourceforge.net/tracker/?group_id=186624&atid=918033l">
-create a bug report</a> with description of your actions along with the log file. You can find the log file at:</p>
-
-<tt align="center">%1/pymoul.log</tt>
-
-<h4>Donation</h4>
-<p align="justify">If you like the tool please consider to <a href="%2">donate</a> some money to sponsor my work. The tool is created in my free time as an open source project. You can sent money to my <a href="%2">PayPal account</a> using your PayPal account, credit card or bank account. You can also use the SourceForget.net <a href="%3">donate page</a>. Your money will be used to found my MOUL account and new hardware for my 4 years old computer.</p>
-
-<p>sincerely yours<br>
-Tiran [KI: #00025784]</p>
- """)
- paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&bus...@ch...&item_name=Donate for Tiran's open source activities&page_style=PayPal&no_shipping=0&cn=Your note for me&tax=0¤cy_code=EUR&lc=DE&bn=PP-DonationsBF&charset=UTF-8"
- sfdonate_url = "https://sourceforge.net/donate/index.php?user_id=560817"
- self.tb_abouttext.setHtml(about.arg(lookupDir('pymouldir'), paypal_url,
- sfdonate_url))
-
def on_moulIsRunning(self, boolean):
"""
@qtslot moulIsRunning(bool): notify if moul is running
@@ -329,7 +304,34 @@
def _about_init(self):
self.tb_license.setHtml('<pre style="font-size:7pt;">' +
metadata.LICENSE + '</pre>')
+ about = self.trUtf8("""
+<center>
+<h3>Tool for Myst Online : Uru Live</h3>
+<p>(c) 2007 Christian Heimes</p>
+
+<p><a href="http://pymoul.sourceforge.net">http://pymoul.sourceforge.net</a></p>
+</center>
+
+<h4>Bug reporting</h4>
+<p align="justify">If you encountered a bug please <a href="http://sourceforge.net/tracker/?group_id=186624&atid=918033l">
+create a bug report</a> with description of your actions along with the log file. You can find the log file at:</p>
+
+<tt align="center">%1</tt>
+
+<h4>Donation</h4>
+<p align="justify">If you like the tool please consider to <a href="%2">donate</a> some money to sponsor my work. The tool is created in my free time as an open source project. You can sent money to my <a href="%2">PayPal account</a> using your PayPal account, credit card or bank account. You can also use the SourceForget.net <a href="%3">donate page</a>. Your money will be used to found my MOUL account and new hardware for my 4 years old computer.</p>
+
+<p>sincerely yours<br>
+Tiran [KI: #00025784]</p>
+ """)
+ paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&bus...@ch...&item_name=Donate for Tiran's open source activities&page_style=PayPal&no_shipping=0&cn=Your note for me&tax=0¤cy_code=EUR&lc=DE&bn=PP-DonationsBF&charset=UTF-8"
+ sfdonate_url = "https://sourceforge.net/donate/index.php?user_id=560817"
+ self.tb_abouttext.setHtml(about.arg(
+ os.path.join(lookupDir('pymouldir'),'pymoul.log'),
+ paypal_url,
+ sfdonate_url))
+
# ************************************************************************
# time zones
def _timezone_init(self):
@@ -340,6 +342,7 @@
self._timezone_update()
# create a timer to update the display every second
+ # TODO: change timer from every second to every minute
self._timezone_timer = timer = QtCore.QTimer(self)
timer.setInterval(1000) # 1 sec
# TODO: needs optimization? run only when timer tab is active
Modified: pymoul/trunk/src/moul/qt/moulqt.py
===================================================================
--- pymoul/trunk/src/moul/qt/moulqt.py 2007-02-06 15:58:25 UTC (rev 146)
+++ pymoul/trunk/src/moul/qt/moulqt.py 2007-02-06 16:48:27 UTC (rev 147)
@@ -58,15 +58,15 @@
singleapp = SimpleSingleApp('pymoulqt', path=getPyMoulDataDir(check=True))
try:
singleapp.acquire()
+ createLogfile()
except OSError:
- mb = criticalMB(app,
+ mb = criticalMB(None,
app.trUtf8("pyMoul QT already running"),
app.trUtf8("""An instance of pyMoul QT is already running!""")
)
mb.exec_()
sys.exit(1)
- createLogfile()
setupQtExceptHook()
installTranslator(app)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|