After opening the "Preferences" dialog, the mouse cursor is not visible in the main area anymore, even if you move it around. It is visible when hovering other areas such as the thumbnailer or the "Preferences" dialog, though. After closing the "Preferences" dialog, everything works as usual. Strangely enough, this does not happen with other dialogs such as the "Library" dialog or the "Enhance image" dialog.
No problem. :)
I don't really intend on pushing this commit to Subversion. It's just something I use to conveniently handle modified packages on Arch Linux.
Another custom modification for the sake of convenience; this one has been bothering me for a while :p. I can push this, together with updated:
mcomixstarter.pymime/comicthumbsetup.pyREADMEWhy? Why would you want to switch to the old implementation? There is really no benefit, and IMHO not much risks in using
czipfileinstead. As stated on the project page: the code is actually 95% identical to Python 2.6.5’s Lib/zipfile.What about the behaviour change? Are you okay with it?
Fixed.
As mentioned in the commit message, the goal is to support calling
get_virtual_double_pagefor checking another page than the current one (needed by the next batch of commits).Fixed.
It's better than having the logic for page change all over the place (main + image handler + events). The goal is also to cut down on module inter dependencies, especially circular dependencies...
Do you have time to make a bug fix release? I think releasing the current state before pushing anything more is a good idea. No?
I also have quite a few more changes (testsuite for archives (with a few bug fixes), thumbbar handling, process handling simplification, ...) and a few other things (fate of mimes/comicthumb, PIL use on Windows) I'd like to discuss when you have time.
Are you sure that you've pushed your changes?
origin/bpierrestill points to93eea80c9e6b3a5320cef88b5e32c248970a99e9(2015-02-20).I had not. I just pushed my current state.
I'm back. Sorry to keep you waiting. I will reply to your post from 2015-02-25.
I see.
I guess I will see those changes in newer commits.
I understand why you want to see
czipfilein action. I have in mind that the switch should work as a fallback option if something breaks so that the user does not need to wait for an update that fixes it. (A possible workaround for the user would be extracting the archive(s) manually.) On the other hand, I cannot recall cases of users complaining about slow extraction of encrypted zip files, so it seems to be a very rare case anyway. Therefore, I think now that the switch I proposed is actually not that important. Just keep the currentczipfilesolution the way it is now.I just tested it and yes, the new behavior feels more naturally to me.
Thanks. :)
I see, thank you for the explanation.
Thanks. :)
Yes, indeed.
I have some more time now, possibly enough for a new release. (I hope so!) However, I am a bit confused about what you mean by "current state". The commits I reviewed so far do not exist anymore, at least that is what the hash codes tell me. Also, there are newer commits in your repository. Could you please tell me which one of the commits I can currently see in your repository is the "current state"?
I guess that
841d51f77dd34f218d493b1964e94db96d6b104fcorresponds to the93eea80c9e6b3a5320cef88b5e32c248970a99e9commit I mentioned earlier (because the timestamps match). That means that I haven't seen any of the commits newer than this one. I would like to review the commits from this one up to this "current state" commit.By "current state", I meant the current Subversion trunk.
I regularly rewrite the history on my Github branch (to keep the history clean), which is why the hash codes have changed. What you have reviewed is now: https://github.com/benoit-pierre/mcomix/compare/6c1518cd3bcdd9be1060040cf1a7949d47dbc15f%5E...995bd51a4e2be106e556f6a551c5f4d60d93741a
Those include the 3 fixes mentioned (Python version change + empty archives in edit commands dialog + assertion with backward 10 pages).
New changes are: https://github.com/benoit-pierre/mcomix/compare/995bd51a4e2be106e556f6a551c5f4d60d93741a...bpierre
I can rearrange those to group them by category and give you a rundown of each batch to make it easier to review if you want.
Thank you for clarifying. A rundown would be nice. I'm currently testing [r1125] a bit. I just found some inconsistencies when you try to use
Ctrl+PgUporCtrl+PgDownto go to another book. Please have a look at the following table.I think it would be better this way:
Also, when an empty archive is opened, the "Edit commands" dialog raises exceptions (because it cannot expand symbols like
%fin the current context, I guess). This does not happen in any of the other cases if I tested it correctly.Related
Commit: [r1125]
Last edit: Ark 2015-03-14
Empty directories handling
So if I have the following filesystem tree:
And I start MComix like this:
mcomix tmp1, then 'Ctrl+PgDown' will showtmp2, and pressing it again will showtmp4, skipping over the emptytmp3directory, which I think make sense, no? You would liketmp3to be shown, even if empty?Exceptions in "Edit commands" dialog when archive is empty
This is fixed in my branch.
Yes, this is correct, I would like to see an empty
tmp3in this example. Reasoning:Ctrl+PgDownbut the following 100 directories or so contain about 1000 files each, none of them being an image, MComix will take a long time scanning directories for nothing.Wrong permissions are not that much of an issue, though: Checking permissions is done fast and if you are in a directory with tons of files and/or directories you are not permitted to read, you are most probably in the wrong directory anyway.
If you are interested in it, we can introduce a pref for this. However, this would be an issue for another release.
I think we need this fix for a release.
And here is a rundown of the new changes in my branch:
archlinux
Custom Arch Linux support, you can ignore this one.
comicthumb: fix Image import (update to PIL)
Self-explanatory.
comicthumb: rewrite to use mcomix
Note: it's slower, because of some of the import/code at initialization
(GTK/GDK imports, looking for
libunrar.so, ...), but I think it's better toavoid the duplication of code, and support the same formats (archives and
images) than MComix itself.
archive: fix non-lazy logging calls
file handler: minor cleanup, remove duplicate call
file handler: small code simplification
remove a bunch of unused imports
A bunch of small changes.
password dialog: show archive path
It can be useful to know the name of the archive whose password is being asked for.
constants: fix GTK import
Already included later in the file, and with a catch for a possible
ImportErrorsomcomix/run.pycan do its thing (detect and warn if GTK cannot be imported).drop unused mcomix/debug
No need for this anymore I think. Better to use the logger.
run: add SIGCHLD handler to reap zombie processes
Don't leave zombies when calling external commands.
process simplification
Looking at the use cases, there are 2:
So simplify the code to cover those. Also, simplify the use of external archive extractors: redirect stdout to output file, instead of reading it and then writing it ourselves.
process: add find_executable
archive: simplify checks for external executables
Use distutils.spawn.find_executable: no point in spawning a subprocess.
test/archives
archive: fix tar listings
test/archives: add tests for option like entries
archive: fix external RAR when an entry starts with @
test/archives: add tests for glob like entries
archive: fix external ZIP for glob like entries
test/archives: mark some tests as xfail
test/archives: add password tests
archive: fix possible hang with external ZIP
test/archives: mark some tests as xfail
archive: cosmetic
test/archives: add basic recursive archive tests
archive: fix RecursiveArchive init
test/archives: add basic unicode tests
test: change
__init__test/archives: improve handling of temporary directories
test/archives: mark some tests as xfail
test/archives: remove unused code
Add a testsuite for
mcomix/archive, and fix a bunch of small issues found thanks to it. Note: if this is to be pushed to Subversion, then I'll commit the archive samples intest/files/archives/(it's pretty small: about 240K); since they can be automatically created on Linux, but not (always) on Windows.[wip] win-install.txt (github.com)
Personal notes for setuping a Windows environment for testing. Could be added to a new HACKING readme or section in README?
thumbbar: cleanup
avoid the need for the _selection_is_forced hack
to detect selection on mouse click
assertion 'tree_view->priv->tree != NULL' failed
thumbbar: align selection on change
Attempt at fixing the fact that on startup, the selected tumbnail in the thumbbar is not in view... Aligning the selection so it stays 1/4 in the view is the only way I found to make it visible, but it does change the behaviour a little. Note: this is not done on mouse click, as it would be annoying. Also, the selected thumbnail does not appear as such on startup (background color not active), so still a work in progress...
fix "don't act on click to focus" handling
It was only working if the mouse pointer had passed over the main area; i.e. the following sequence would not work correctly:
file handler: improve 'goto last read page?' popup
Show the first page and start loading thumbnails before showing it:
Not sure about this one, since we don't always show the cover: when switching from the next archive with Ctrl+PageUp => last page is shown. So maybe better to start showing the last read page, what do you think?
list of supported image formats: there can only be one!
This way we get support for all GdkPixbuf supported formats (like WebP if gdk-pixbuf-webp is available).
Going forward, I think it would be best if the code used
image_tools.is_image_fileonly, andconstants.SUPPORTED_IMAGE_REGEXwas folded intoimage_tools: this make it easier to change the library used for loading images (like using PIL, see below).thumbnail tools: small optimization
thumbnail tools: fix possible PIL exception
image handler: add debug trace on thumbnail error
image tools: add get_image_info
image handler: remove GDK dependency
thumbnail tools: remove _get_text_data dependency on PIL
[wip] thumbnail tools: _thumbnail_exists; PIL -> GDK
Same rational as above: try to reduce image library dependency to
image_tools. Also avoid inconsistencies: using PIL for image information when GdkPixbuf is actually used to load images.image tools: optimize load_pixbuf_size
Right now, when creating a thumbnail, the code will load the full image, and then use the current scaling mode preferences to resize it. This can be really slow. I personally don't see the point in generating a 128x128 thumbnail with Hyperbolic scaling, when the result of
gdk.pixbuf_new_from_file_at_sizeis good enough for this. Also, it's much faster for image formats like JPEG, or WebP: the decoder can be configured to automatically scale down the output of the decoding.image tools: disable force use of PIL on Windows
I was looking at using PIL (initially for WebP support), and my tests shows that it is much slower than GdkPixbuf: both on Linux and on Windows (testing with Wine). So I wonder if this still make some sense? I don't see the "GTK slowness" mentioned in the comment, maybe because I'm using GTK version 2.24.2 instead of 2.18.2. Do you have a real Windows machine to test this?
use open() instead of file()
osd: use mcomix.constants for black/white colors (github.com)
do not use gtk.gdk.colormap_get_system (github.com)
use gtk.main_iteration_do instead of gtk.main_iteration (github.com)
status bar: do not use -1 for context id
status bar: do not use widget.set_data/get_data (github.com)
do not use deprecated dialog.set_has_separator (github.com)
do not use pango.SCALE_XXX constants (github.com)
I was looking at whether updating to GTK3 is possible, and actually have a version that starts (and somewhat works) after tweaking the code a little. Those changes are needed, and still compatible with GTK2, so I think they can be pushed, what do you think?
This patch does not depend on others, so it can be pushed to Subversion, but the "empty archive" support would still not be complete: like with the properties dialog.
It would make more sense then to push the whole batch.
Thank you very much, it is very helpful. I hope it's okay for you if I skip commenting on some of the commits since I don't have always something profound to say.
I have to admit that I don't know much about these (seemingly high-level) things. What is the purpose of
comicthumb? For me, it looks like some file browser like Nautilus might want to run this code to create and display thumbnails. Is this correct?What happens if this code runs into an encrypted archive? (Just as I said, I don't know when this code is supposed to be executed so I can't test it myself.)
Any way, I both like and dislike this change at the same time. That is, I totally agree with what you are trying to accomplish but I think it's not a good idea to do it this way. For example,
thumbnail_tools.Thumbnailer()depends onprefsso if the preferences are broken for some reason, it also breakscomicthumbeven if it does not actually needprefs.Therefore, I think it's better to do it this way: Try to refactor source files like
thumbnail_tools.pyto isolate the shared code. That is,comicthumbshould be able to call the functions it needs directly, without the need to load any libraries, prefs, etc. it does not depend on. Do you know how Python behaves on imports? If an import makes Python run code, it might be a good idea to move the functions shared bycomicthumbto separate code files which only import the packages the shared functions really need.What do you think? Any other suggestions or objections?
Okay.
Sorry, I did not yet understand the new code.
Wow, nice one. (I hope this doesn't break anything.)
Good idea. Small fix: I think it's better to use
%sinstead of concatenating the archive's path here. Just copy the way it is done in other parts of the code, for example (extracted from some source file):I see. Well spotted!
Okay.
This issue bothered me for a long time. Thank you very much for fixing it.
Interesting changes. Maybe you can declutter the code a bit even further by making
find_executableaccept iterables of strings so the code here …… can be changed to look like this:
Note that in the example above, I changed the idiom to remove one of the
returnstatements. The source files for the other archive types may be simplified this way as well.Does
from distutils import spawnalso introduce a new external dependency?I think I got the idea why "option-like entries" need special treatment but I did not yet understand what actually happens if they occur. Furthermore, I am not used to testing in Python so I cannot say much about it here except that, apparently, it is a very good idea and the test suite seems to cover a lot of corner cases. Thank you very much.
I think it is okay if you commit the archive examples as well. (By the way, it's not 240K but only 24K.)
Maybe the Wiki is a better place for these kinds of notes. How about a new section in https://sourceforge.net/p/mcomix/wiki/Maintainance/?
This one has bugged me as well. One thing I would like to see changed, though:
This bug is quite annoying. However, I think it is more important to have the current image highlighted than to see it in the thumbnailer. (That is, the old bug here is better than the new one.) It would be nice to see this one fixed as well, but if it turns out to be surprisingly difficult, it might be better to return to the old behavior and postpone the fix to another release.
I suspect that this has something to do with the rearrangement of the items in the list if some of the thumbnails turn out to be of a different size than expected, but this is merely a wild guess.
Wow, very well spotted! Thank you.
Good question. I think it's better to separate the way books are being opened from this dialog. That is, for example, if you press
Ctrl+PageUp, MComix should always go to the last page first. Then, if MComix wants to ask the user, the dialog appears. However, if MComix has been told to "Do not ask again", MComix should go straight to the respective page (that is, the last read page or the first page, depending on what has been chosen beforehand).There is an inconsistency: If you "Go -> Next archive" to a book, you get asked whether to go to the last read page or not. However, if you "Go -> Previous archive" to the very same book, you do not get asked.
What do you mean by "see below"? I think the solution you offer with this commit is good enough. So how are further modifications supposed to make things easier? Sorry, I just don't fully understand.
Okay.
Nice. A function that extracts metadata might be very useful for better caching algorithms, for example.
Okay.
I understand what you are trying to accomplish but I did not yet fully understand the code.
I see. Maybe
comicthumbcan benefit from this, too. (Not sure, though.)Sorry, I did not benchmark this and I don't have access to a Windows machine.
Interesting. I don't know much about the differences between GTK2 and GTK3 (admittedly, I don't even know GTK2 very well) so I'm glad you're dealing with this issue. Actually, I don't like the idea that switching to another library might break something. On the other hand, these changes don't look like they are going to break things easily. Is it okay for you to postpone these "in prevision of GTK3 support" changes for a later release?
Again, thank you very much for your work. It took me a while to review all these commits. Is it possible to push only some of them to SVN? If so, I would like to choose the ones to be included in the upcoming release.
Yes.
It won't work on encrypted archives.
I agree that preferences should only be accessed by higher level (near the GUI) code.
comicthumbis also really not a priority for me (I don't use a graphical file manager). I also wonder how many MComix users use it: nobody on Windows, and on Linux, there are probably other thumbnailers available. This way was the easiest and the fastest, and ensure we get a consistent behaviour betweencomicthumband MComix: same supported formats (archive+images), same cover detection.Doing it this way means the gettext translations don't need to be updated. I also think it's better to show the full path.
Agreed.
No.
We may not get the data we asked for (when using the external ZIP executable), because the entry will be interpreted as a pattern.
No, the current directory contains only 24K, but the testsuite generate more test files:
The total size of the directory with these new files is 240K.
I'm not too fond of the Wiki, I prefer the documentation to be versioned alongside the code.
I really don't know about this part of the code. I don't use a DE, or a graphical file manager, so the drag&drop code is of no use to me. Does it not work with the actual code?
Maybe.
I think it's by design. I personally don't like the behaviour when switching page/book.
It's better if the dependency on a particular image library is constrained to
image_tools, instead of various parts of the code. This commit helps, so do the following commits.It's a little more complicated with GDK than when using PIL because we can't use
pixbuf_get_file_infoto retrieve the image option, and so using thePixbufLoaderis the only way to not load and decode the full image to retrieve those options.For references, when creating 128x128 thumbnails for 132 JPEG images (~3.8MB / 4038x6057 per image):
OK. How do you generate the Windows distribution of MComix?
Sure, but the risk with those changes is really really low (especially the first 4).
Maybe, depends on the commits. Tell me which ones and I'll check.
Further proof that
comicthumbis basically dead code:mime/mcomix.thumbnailershould be renamed, updated, and used instead, see fix)Agreed.
Agreed, you have a point there.
I see.
Now I see. Considering that
mcomix-large.pngneeds 2.2MiB, I think it's okay if we add 240K in this case.I see. Maybe it's a good idea to create a subdir for these kinds of documents? Any way, I think another name would be more appropriate, see https://xkcd.com/932/.
At least on Linux, it does work. (Actually, I just installed thunar and tried a drag&drop and it worked. I did not check whether the code in mind had been executed in this case, though.) Okay, just leave it this way.
Are you able to tell whether the highlighting I mentioned is now missing due to these changes? If this is the case, I would like to postpone these changes because the missing highlighting makes the GUI look more broken than the first thumbnail being out of view.
Could you please describe the behavior you prefer?
I am a bit confused. From your point of view, how are which image libraries supposed to perform which kinds of tasks? From my point of view, I would like to see Pillow doing everything it can be used for. That is, GDK/Pixbufs should be used only if really necessary (which might limit this to displaying images in the GUI).
Nice.
Actually, I don't build the Windows versions, Oddegamra does. (I think I already mentioned this before.) Maybe he can explain what this "GTK slowness" is all about.
Okay, agreed.
All commits up to
233276b1883fd9741f9f21986c89a789ef86d1b4(2015-03-12 23:20:55) excluding the commit(s) which break(s) the thumbnailer (that is, the change I marked with postponed) can go to the SVN repository.HACKING? It's a pretty common use for this, no?
Apparently
file://hostname/pathis valid: file URI schemeHere is how I handle it in my comic viewer (no last read page support):
With last read page support, maybe we should always ask the user when switching to an archive? (If there is a last read page and we're not already on it of course).
I used to think the same, but after investigating Pillow has an alternative for WebP support (on Linux gdk-pixbuf-webp can be used) I know think that GdkPixbuf should be preferred over it. Here is why: my experience is that using PIL/Pillow make the UI more sluggish. I think the problem is, with PIL/Pillow, we shift some treatment from C to Python, and with Python threading model, the result is a perceptible reduction of MComix interface reactivity.
You can test for yourself with this patch:
OK, so here is what I plan to push to Subversion: incoming!
It's everything minus:
comicthumb:archive.ask_for_passwordNote that this include removing the "force PIL on Windows" code, so maybe we could ask Oddegamra to create a candidate release version for Windows and post a news item asking our Windows users for feedback?
Apparently, yes. However, I thought that some inexperienced users might get the wrong idea when reading the name of this document. So, maybe it's better to move it to a subdir, e.g.
docs/HACKING. (Sorry, I know that it sounds a bit stupid.)I see. Well, I was not sure how
localhostmust be resolved but according to Wikipedia,localhostis reserved and always points to a loopback device. (If I got it right, it also means that it does not need to be listed in/etc/hoststo be resolved appropriately.) So it seems that we can leave it the way it is but I still think that a new function would make code cleaner. (On the other hand, I cannot test it in Windows, only in Wine, so this might break things albeit stackoverflow suggests that it should work fine.)Thank you for the explanation. So the only(?) difference is that, currently, switching to the previous archive opens its last page rather than its first page. I have an idea but it needs some more time so let's postpone the discussion for a later release.
I did not yet test it but let's postpone the discussion as well.
The
incomingbranch looks promising, thank you. Please push it to SVN now.A candidate release sounds interesting but I don't want to ask Oddegamra too often for a release. I also think that this "force PIL on Windows" issue might need a specific setup Oddegamra is already aware of. Maybe we should ask him for clarification first. While he is at it, he might also want to check how to deal with
czipfileon Windows.That is, instead of a candidate release, we should ask him for testing these Windows-specific changes. If he says that everything runs fine, we will later ask him to prepare a new release (especially for Windows). What do you think?
Note to self: Implement
path_to_urlfunction before asking Oddegamra for testing.Done.
Right.
There is a Windows installer available here.
Agreed.
While we'are on the subject of the Windows release, I wonder if we should include the licences for some of the libraries? (UnRAR.dll, GTK, ...). Also, maybe we could bundle MuPDF so PDF support is working out of the box?
What is your opinion on https://sourceforge.net/p/mcomix/bugs/73/?limit=25&page=1#0e07? (Maybe I have missed something or there is a misunderstanding.)
I also edited the table about empty archive handling so it always says "Yes" in "Can navigate from". Currently, you can enter an empty archive with
Ctrl+PgDownbut you cannot leave it this way, which makes the navigation feel broken.I have pushed a fix for page navigation in empty archives. That live the case of empty directories.
I see that you pushed a change to
mime/comicbook.schemas, I forgot to do it, but we should really just remove it: this method of handling thumbnails has been deprecated for a long time.Thank you. I still think that the user should be able to switch to empty directories. (I wonder why the code makes it possible for MComix to treat archives differently anyway.) It would make the behavior more consistent. For example, if there is a broken image, MComix indicates that it is broken and displays a dummy image rather than omitting the image entirely. Books should be treated similarly.
Admittedly, I just thought that the change might fix more things than it breaks. Maybe this file has been kept for backward compatibility? I don't know.
How about something along those lines:
Thank you for the patch but for some reason, I cannot apply it:
(Using
svndoes not work either.) Maybe it's because the diff is broken thanks to this board's quirks, I don't know. Could you please create a new patch and attach it as a file to the post?Concerning [r1209]: Thank you. Apparently, actions like
Ctrl+NandCtrl+Pare broken as well.Related
Commit: [r1209]
Here you go.
Since may 2013 apparently... :P
Related
Commit: [r1209]
We also keep the same file provider after closing an archive. It is the behavior we want? (Ctrl+N/Ctrl+P will go to the next/previous directory of the previously opened archive)
Good question. (It never occured to me to hit
Ctrl+Pafter closing a book.) I think it's better to reset everything so it behaves as if no book had ever been opened. (I think of it as a privacy issue.) In other words, commands likeCtrl+Pshould be disabled and should not work because they do not know what to do (or where to go to).Thank you for the patch file. The indentation was incorrect when I tried to create a patch file from what you posted earlier. Please always supply patches by attaching them.