Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-16-2008, 12:18 PM   #196
gwynevans
Wizard
gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.
 
gwynevans's Avatar
 
Posts: 1,343
Karma: 1065246
Join Date: Nov 2007
Location: UK
Device: Sony 505 (retired), iPad2, iPhone 3GS & Nexus 7 3G
Try a "make" or "make gui" at the top level?
gwynevans is offline   Reply With Quote
Old 04-16-2008, 08:41 PM   #197
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 942
Karma: 567366
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
That worked. I thought I could run it within Eclispe and see the changes. Is that true only for the UI files? I thought since Python was an interpreted language I could just change the text files.
astrodad is offline   Reply With Quote
 
Enthusiast
Old 04-17-2008, 01:59 PM   #198
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 942
Karma: 567366
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
Well it works so I am not complaining. One thing that is weird is that I cannot save the preferences in the config dialog and I'm not getting any errors. If I make a change in the config GUI, hit OK, and go back. It's there. But when I close the app and re-open, the preferences are not saved. This happens from within PyDev and from the command line.
astrodad is offline   Reply With Quote
Old 04-18-2008, 06:01 AM   #199
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,617
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You just need to run "make test" in the gui2 directory. You can setup a run profile in eclipse to run it automatically. The GUI is stored in XML files, which is why they need to be compiled. Not sure why you cant store settings in pydev though.
kovidgoyal is offline   Reply With Quote
Old 04-18-2008, 02:20 PM   #200
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 942
Karma: 567366
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
I've implemented the dialog to accept a standard set of default tags, but there are a couple of glitches. I've also added code to take the value from preferences when importing a new book.

1. I can't save the preference for some reason.
2. The tag editor expects a row index for the book being edited so it can preload the existing tags but obviously in this case there is no real 'book' since we're talking about the defaults. Do you think I should make a version of the TagEditor that doesn't need the row parameter and instead receives the existing string from the dialog?
3. Even though I specify the value when adding a book, they don't get stored. I'll have to play with it some more.

I'm having fun learning the Python code. The white space thing keeps getting me
astrodad is offline   Reply With Quote
Old 04-19-2008, 12:21 AM   #201
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,617
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
1. Don't really know. Perhaps you should try the eclipse forums?
2. A cleaner solution would be to store the default tags in a Settings object (since they're user settings and the database is not really designed to handle that. You could just subclass the TagEditor class and override the API. Use the get and set methods on the Settings object to read/store default tags.
3. Not sure what you mean, can you elaborate?
kovidgoyal is offline   Reply With Quote
Old 04-22-2008, 03:21 PM   #202
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 942
Karma: 567366
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
Kovid,

I've created a new class called DefaultTagEditor and I think I have the right code to implement TagEditor so that I can override the _init_ to change the way it reads the existing tags. I'm getting an error, though. Here's the code:
Quote:
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
from PyQt4.QtCore import SIGNAL, Qt
from PyQt4.QtGui import QDialog, QMessageBox

from libprs500.gui2.dialogs.tag_editor_ui import Ui_TagEditor
from libprs500.gui2 import qstring_to_unicode
from libprs500.gui2 import question_dialog, error_dialog
from libprs500.gui2.dialogs import TagEditor

class DefaultTagEditor(QDialog, Ui_TagEditor, TagEditor):

def __init__(self, window, db, tagStrings):
QDialog.__init__(self, window)
Here's the error:
Quote:
Traceback (most recent call last):
File "/home/javier/workspace/libprs500/src/libprs500/gui2/main.py", line 34, in <module>
from libprs500.gui2.dialogs.config import ConfigDialog
File "/home/javier/workspace/libprs500/src/libprs500/gui2/dialogs/config.py", line 12, in <module>
from libprs500.gui2.dialogs.default_tag_editor import DefaultTagEditor
File "/home/javier/workspace/libprs500/src/libprs500/gui2/dialogs/default_tag_editor.py", line 9, in <module>
from libprs500.gui2.dialogs import TagEditor
ImportError: cannot import name TagEditor
astrodad is offline   Reply With Quote
Old 04-22-2008, 03:50 PM   #203
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 942
Karma: 567366
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
OK, ignore the last post. I figured that out. I think I'm almost there.
astrodad is offline   Reply With Quote
Old 04-22-2008, 09:22 PM   #204
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,617
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That's great.
kovidgoyal is offline   Reply With Quote
Old 04-23-2008, 10:00 AM   #205
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 942
Karma: 567366
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
One thing that's interesting. In trying to use my new DefaultTagEditor, I get an error when the accept runs. Here's what happens:

Quote:
Traceback (most recent call last):
File "/home/javier/workspace/libprs500/src/libprs500/gui2/dialogs/config.py", line 106, in edit_defaultTags
tag_string = ', '.join(d.tags)
TypeError: sequence item 0: expected string, QString found
Here's the code that invokes the default tag editor:

Quote:
def edit_defaultTags(self):
d = DefaultTagEditor(self, self.db,self.defaultTags.text())
d.exec_()
if d.result() == QDialog.Accepted:
tag_string = ', '.join(d.tags)
self.defaultTags.setText(tag_string)
I didn't change anything about the tag editor except that I changed the init to not look for the existing tags from a book, but from the Settings object. Any ideas?

Here's the new editor code:

Quote:
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
from PyQt4.QtCore import SIGNAL, Qt
from PyQt4.QtGui import QDialog, QMessageBox

from libprs500 import islinux, Settings
from libprs500.gui2.dialogs.tag_editor_ui import Ui_TagEditor
from libprs500.gui2 import qstring_to_unicode
from libprs500.gui2 import question_dialog, error_dialog
from libprs500.gui2.dialogs.tag_editor import TagEditor

class DefaultTagEditor(TagEditor):

def __init__(self, window, db, tagStrings):
QDialog.__init__(self, window)
Ui_TagEditor.__init__(self)
self.setupUi(self)

settings = Settings()

self.db = db
self.tags = tagStrings.split(',')

if self.tags:
for tag in self.tags:
self.applied_tags.addItem(tag)


all_tags = [tag.lower() for tag in self.db.all_tags()]
all_tags = list(set(all_tags))
all_tags.sort()
for tag in all_tags:
if tag not in tagStrings:
self.available_tags.addItem(tag)

self.connect(self.apply_button, SIGNAL('clicked()'), self.apply_tags)
self.connect(self.unapply_button, SIGNAL('clicked()'), self.unapply_tags)
self.connect(self.add_tag_button, SIGNAL('clicked()'), self.add_tag)
self.connect(self.delete_button, SIGNAL('clicked()'), self.delete_tags)
self.connect(self.add_tag_input, SIGNAL('returnPressed()'), self.add_tag)
self.connect(self.available_tags, SIGNAL('itemActivated(QListWidgetItem*)'), self.apply_tags)
self.connect(self.applied_tags, SIGNAL('itemActivated(QListWidgetItem*)'), self.unapply_tags)

def apply_tags(self, item=None):
items = self.available_tags.selectedItems() if item is None else [item]
for item in items:
tag = qstring_to_unicode(item.text())
self.tags.append(tag)
self.available_tags.takeItem(self.available_tags.r ow(item))

self.tags.sort()
self.applied_tags.clear()
for tag in self.tags:
self.applied_tags.addItem(tag)
astrodad is offline   Reply With Quote
Old 04-23-2008, 12:32 PM   #206
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,617
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use
Code:
tags = [qstring_to_unicode(t) for t in d.tags]
kovidgoyal is offline   Reply With Quote
Old 04-24-2008, 11:22 AM   #207
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 942
Karma: 567366
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
Thanks! I've modified database.py to get the default tags from Settings and then to call set_tags, but here's what's stored:

default tag is test,test2
stored tag: ., 0, 4, 6, <, >, c, l, q, p, s, a, b, e, d, g, i, j, o, n, r, t, y, x, 5, 9

here's the code (i know I need to add a check to make sure we actually have default tags, but I'll do that as soon as I know this works)


Quote:
settings = Settings()

self.set_tags(id, unicode(settings.value("defaultTags").toString().s plit(',')) )
astrodad is offline   Reply With Quote
Old 04-25-2008, 12:17 PM   #208
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,617
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use the get and set methods on the Settings object (much more python friendly), that should automatically fix this problem. Also as a stylisic note use descriptive phrases for settings, something like "default tags" rather than defaultTags
kovidgoyal is offline   Reply With Quote
Old 05-07-2008, 11:00 AM   #209
ligos
Junior Member
ligos began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2007
Device: sony reader
I downloaded the newest version of libprs500 -0.4.51 ie calibre and it worked-I could fetch the news from built-in recipes as well as my own. But when I started the program next day it failed to fetch any of the news. It shows the following traceback:
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8c in position 113: ordinal not in range(128)
Failed to perform job: Fetch news from FAZ NET
Detailed traceback:
Traceback (most recent call last):
File "parallel.py", line 139, in run_job
File "calibre\ebooks\lrf\feeds\convert_from.pyo", line 40, in main
File "calibre\web\feeds\main.pyo", line 128, in run_recipe
File "calibre\web\feeds\news.pyo", line 810, in __init__
File "calibre\ebooks\lrf\web\profiles\__init__.pyo" , line 174, in __init__
File "calibre\ebooks\lrf\web\profiles\__init__.pyo" , line 225, in build_index
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8c in position 113: ordinal not in range(128)
Log:
Fetching feeds...

I think I had similar problem with few previous versions(however I do not have any confirmation it is exactly the same-the problem as I recall was with ASCII as well)-as far as I remember from 0.4.46.

Does anybody know how to remove the error?
ligos is offline   Reply With Quote
Old 05-07-2008, 12:12 PM   #210
sigmax
Connoisseur
sigmax has learned how to buy an e-book online
 
Posts: 53
Karma: 92
Join Date: Apr 2008
Location: Uruguay
Device: SONY PRS-300
Hi Ligos!

I have the same problem as you do, but I could not get it to work since day one. As I try to get a rss feed (any of the included ones in calibre), it takes a lot of time just to report an error like yours stating the ascii thingy.

Nevertheless, if I use the command line, I can get the feed.

Regards,

sigmaX
sigmax is offline   Reply With Quote
Reply

Tags
libprs500, prs-505

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
libprs500 tommy still Calibre 2 02-09-2008 10:55 AM
Using libprs500 jerryleejr Calibre 2 01-28-2008 12:29 AM
Using Libprs500 for 505 JeffASonyReader Calibre 17 01-21-2008 09:34 AM
Help!!! libprs500 MountainMan Calibre 11 11-13-2007 11:25 PM
libprs500 and 505 carchase Sony Reader 6 10-28-2007 03:06 PM


All times are GMT -4. The time now is 04:52 AM.


MobileRead.com is a privately owned, operated and funded community.