12-04-2014, 08:19 AM | #76 | |
Member
Posts: 14
Karma: 10
Join Date: May 2014
Device: kindle paperwhite
|
Quote:
Thanks anyway. |
|
12-04-2014, 08:45 AM | #77 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
If only one instance of Sigil is running, enumerating all windows will definitely get you the right title. For example, this code that I stole from stack overflow works just fine: Code:
#!/usr/bin/env python import ctypes def run(bk): EnumWindows = ctypes.windll.user32.EnumWindows EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)) GetWindowText = ctypes.windll.user32.GetWindowTextW GetWindowTextLength = ctypes.windll.user32.GetWindowTextLengthW IsWindowVisible = ctypes.windll.user32.IsWindowVisible titles = [] def foreach_window(hwnd, lParam): if IsWindowVisible(hwnd): length = GetWindowTextLength(hwnd) buff = ctypes.create_unicode_buffer(length + 1) GetWindowText(hwnd, buff, length + 1) if buff.value.find('Sigil') > 0: titles.append(buff.value) return True EnumWindows(EnumWindowsProc(foreach_window), 0) print(titles) return 0 def main(): print('I reached main when I should not have\n') return -1 if __name__ == "__main__": sys.exit(main()) |
|
Advert | |
|
12-04-2014, 03:46 PM | #78 | |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
And I found something for Windows too, but it's ugly. https://stackoverflow.com/questions/...age-on-windows |
|
12-05-2014, 11:41 AM | #79 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Hi All,
DiapDealer has figured out a way to make the launcher_updater_20141204.zip actually run by running python directly on the zip file!!!! So there is now a completely new version of the launcher_updater_20141204.zip up there. The payload is exactly the same as all previous versions See the second post. Special thanks to DiapDealer for his great work on this! Thanks, KevinH ps. After some discussion we have decided not to force use of sudo, so that Linux and Mac OS X users that install Sigil locally (inside their own home directory) do not have to needlessly run sudo which reduces any possibility of potential misuse. If it has permissions, it will properly write the files, if not, you will see a clear message of what it tried to install and where, and you can then decide if you want to run sudo or not to let it do its own thing. Ditto for Administrator command line prompts on Windows. Last edited by KevinH; 12-05-2014 at 11:45 AM. |
12-05-2014, 12:21 PM | #80 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
I have tested the new updater with the official 64bit Windows build and DiapDealer's 64bit Linux build and it worked as designed when executed as root/admin.
For testing purposes, I also repeated the test without root/admin rights. It initially failed but then displayed a folder selection dialog box only to fail again afterwards even if the correct folder was selected. Maybe it should completely fail at this point and ask the user whether they are root or have admin rights, because the chances of users using non-standard install folders is relatively slim and those users are presumably knowledgeable enough to manually update the launcher files. |
Advert | |
|
12-05-2014, 12:35 PM | #81 | |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Hi Doitsu,
I guess it depends on what types of systems you are used to working on. Here at my university many students who do research share accounts on a school cluster but have no permissions to install anything outside of their home and so they often install packages and software and in their own home directory. They can not be root/admin as they are not provided with that. The launcher_updater_20141204.zip was designed to search "standard locations" that typically would require admin/root privs but not always. If that fails, it opens a gui for the user to navigate to his own copy where-ever it may be in his own home or area, or on an external volume or usb key or a dev folder or net drive or wherever?. Once selected, the installer should run just fine for them without need for sudo/root/admin privs. I could of course skip that part for Windows users as this case probably never arises for them, but it is often found at universities, shared web services/companies, on company servers, on locked down boot systems who run linux / unix shared systems under a separate administrator. Many student developers at our university are faced with exactly this situation when at school. I hope this explains the reasoning for why the gui comes up. It is to allow the user one more chance to find the proper location if the user's set-up is at all unique in any way. It is not meant just to retry what just failed. If you so desire you can simply hit "Cancel" when it comes up and the installer will stop. Take care, KevinH Quote:
|
|
12-05-2014, 01:30 PM | #82 |
Grand Sorcerer
Posts: 28,038
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Hey, cool! Glad it's working.
|
12-05-2014, 03:35 PM | #83 |
Grand Sorcerer
Posts: 28,038
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
For Windows users who may be unaware of how to start an administrator (elevated privileges) command prompt ... one of the easiest ways is from the Start menu. Go to Programs->Accessories; then right click on "Command Prompt" and select "Run as Administrator."
You'll have to cd to the directory where you saved "launcher_updater_20141204.zip", of course, before running the python command to launch the updater. If you need to do this kind of thing a lot (like me), that whole "cd"-ing around can get to be a pain in the butt. I've found a fairly simple script that will add a context menu item to Windows Explorer. It allows you to right-click on any folder in Windows Explorer and select "CMD here as Admin." You get the UAC prompt and, BOOM ... an command prompt in the correct folder with elevated privileges. It's a registry text file (*.inf) that you right click on and choose "Install". It also provides an uninstall option in the standard add/remove programs should you want to get rid of it. It's only for Vista and Win7, since Win8 already has the feature and XP doesn't need it. I'll post it if there's an interest. Last edited by DiapDealer; 12-05-2014 at 03:43 PM. |
12-06-2014, 08:05 AM | #84 |
eBook FANatic
Posts: 18,301
Karma: 16071131
Join Date: Apr 2008
Location: Alabama, USA
Device: HP ipac RX5915 Wife's Kindle
|
Question about epubcheck
If I have a file name e.g.
Code:
Openings in the Old Trail If I replace the file name with Code:
Openings_in_the_Old_Trail |
12-06-2014, 08:44 AM | #85 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
In your case you'll find that you missed a space between Old and _Trail: Code:
<item href="Text/Openings_in_the_Old%20_Trail_0001.htm" id="Openings_in_the_Old__Trail_0001.htm" media-type="application/xhtml+xml" />
If you have more plugin-specific questions, please post them in the thread where you downloaded the plugin from. This thread is primarily intended for plugin developers not end-users. |
|
02-20-2015, 03:20 PM | #86 | |
Member
Posts: 19
Karma: 10
Join Date: Mar 2014
Location: Budapest/Hungary
Device: Kindle4,reMarkable2,MoonReader Pro
|
Quote:
I am trying to write a wrapper around 'xsltproc', but I just started checking out the new version of Sigil today, and currently I am pretty tired, so that has to wait. In it I would like to offer the possibility to apply a style upon the currently opened editor document (would need a way, to find out, which file is being frontmost) or selected or all xhtml files. Also, with xsltproc the problem is, that it only supports XSLT v1, which is a little weak. But may be well enough suited for the task at hand. Andreas |
|
02-20-2015, 04:04 PM | #87 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
BTW, for simple html manipulation BeautifulSoup might do the trick. |
|
02-27-2015, 05:42 AM | #88 | |
Member
Posts: 19
Karma: 10
Join Date: Mar 2014
Location: Budapest/Hungary
Device: Kindle4,reMarkable2,MoonReader Pro
|
Quote:
QString QTabWidget::tabText(int index) const Returns the label text for the tab on the page at position index. See also setTabText(). and currentIndex : int This property holds the index position of the current tab page. That would allow to query the currently opened tab's filename and compose a full filespec from it. |
|
02-27-2015, 05:47 AM | #89 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
|
02-27-2015, 02:38 PM | #90 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Hi,
Yes it is a limitation of the current plugin api but if something like this is important we could add support for it in a future version of the plugin launcher. It could be as simple as always writing a list of selected files "in order" in xml to the temp directory before invoking the plugin. The plugin itself can then decide whether to use that xml list, or work on the entire set of book files, or throw up a gui to select which files you would like to have processed. Let me think about how that best could be implemented with the fewest number of interface changes that would maintain backwards compatibility. Kevin Last edited by KevinH; 02-27-2015 at 03:47 PM. |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Loading Plugin in development | Sladd | Development | 6 | 06-17-2014 07:57 PM |
Question for plugin development gurus | DiapDealer | Plugins | 2 | 02-05-2012 12:33 AM |
DR800 Plugin development for DR800/DR1000 | yuri_b | iRex Developer's Corner | 0 | 09-18-2010 10:46 AM |
Device plugin development | reader42 | Plugins | 10 | 03-29-2010 01:39 PM |
Calibre plugin development - Newbie problems | minstrel | Plugins | 5 | 04-12-2009 01:44 PM |