I want to create a suggestions system for a console I'm embedding into my interface, but there's one feature I want to add that I don't see how to. My inspiration is how minecraft consoles work:
As you can see, the autocomplete tries to fill up the rest of the lineEdit based on what the first suggestion in the input is. I assume that this behaviour could be replicated using the placeholder text system we have now, but I don't really see how to make the placeholder show when there's text written. Any ideas?
Related
I am currently developing an automated test case which performs actions on a console application (very simple, just clicking buttons and inputting text).
I have been able to successfully click through the application and input data without many problems, which includes identifying elements and things like that.
I have not been able to verify the existence of GUI elements that aren't clickable, ie an image that is loaded into the console application. I have tried looking through the output when using print_control_identifiers() for any indication of where data about an image in the window might be stored. I have tried looking at the tree diagram of the windows before and after loading the image in to see if it changes (it does not).
I have also then looked into verifying basic things, like font type or other properties that exist in the VS development platform, without success. To do this I used handleprops.font among other things. I have also read through the handleprops class and tried to find anything in there that I can use, but none of it is working.
My question is: is there a way to access an image's information that is stored in the window? I am able to identify where it is stored (picturebox1) and get information about that window (handleprops.rectangle) but cannot get anything about whether the image is there (like a path to image for example). All I can access is 'controllable' items, those that show up in print_control_identifiers()
I'm not sure this is possible with pywinauto but I have been stuck on this for a while and wondered if there were any suggestions people had.
Thanks
On the topic of Python PPTX Internal Hyperlink
Is there a way to create Hyperlinks prior to creating the slides that they will be linked to?
E.g. create a table of contents slide with hyperlinks to the slides that will be added later, the number of slides wont always be the same as it will be edited by the user.
Interesting question. Here's what I found working with a currently selected shape on a slide. I expect you'd be applying hyperlinks to a textrange instead, but the general idea's the same.
A hyperlink to another slide contains no .Address and the .SubAddress looks like:
SlideID,SlideIndex,SlideTitle
SlideTitle can be blank, so I tested with this to link to a third slide that wasn't there:
Activewindow.Selection.ShapeRange(1).ActionSettings(1).Hyperlink.subaddress = ",3,"
No errors, but the link doesn't work either.
This DOES work, however:
Activewindow.Selection.ShapeRange(1).ActionSettings(1).Hyperlink.subaddress = "258,3,"
I run this on a selected shape on the first slide then later add a third slide and the link jumps to it.
The trick then becomes: How will you know what the SlideID will be, this slide you haven't yet added? In a new presentation, PPT will give the first slide an ID of 256 and increment the ID for each new slide you add, but it'll be quite tricky to keep track of SlideIDs and SlideIndexes if you're adding new slides at random places in a presentation, that may have had slides added and deleted beforehand.
Personally, I think I'd add blank slides ahead of time, link to them, then add whatever content's necessary.
I doubt it. Certainly the straightforward way won't work, but it's hard to say never against human ingenuity.
Anyway, the way this mechanism works is based on the PowerPoint hyperlink behavior, there are just special "action" verbs that mean "jump internally" rather than "jump to web address". The verb in this case would be NAMED_SLIDE (although NEXT_SLIDE, LAST_SLIDE, etc. are also available). The "name" of the slide in the XML is its relationship id, basically a keyword like "rId7" for the mapping of one PPTX package part (e.g. slide) to another.
Since there isn't a slide yet, there can be no relationship. Having such a "dangling" relationship would very likely trigger a repair error, but I can't see it working out in any case. Creating a new slide will create a new relationship without regard to relationships that are already there, so best case is your "pre-creation" relationship just gets ignored.
I think you're going to need a different strategy.
I am working on a small project using PyQt5 (Python 3) and I want a widget where a user can select/modify a file, somewhat akin to the left-hand side of file explorer on Windows:
This cannot be done with QFileDialog as I want to display files that are not on the user's drive.
I have tried writing my own, however I am a beginner and I lack the skills to do it correctly (hence the reason why I'm trying to learn). I can provide the code if that would be useful.
Is there such a thing built in to pyqt? Has anyone created one before, with source code available?
Thanks in advance.
EDIT: More specifically I don't want a way to access remote files, just a widget that displays entries (along with icons, preferably) and subentries in a sort of drop-down menu, like the section of file explorer mentioned above. It doesn't necessarily have to be to do with files, consider it a drop-down menu if that helps.
I know this is old but for anyone looking for an answer it's the QTreeView widget.
In a console application, I need to take in credentials. I do it using lineEdit.text() and then clear it. In case I need to edit it, I want to bring back the text on the lineEdit space. How do I do that? Didn't figure out much from the documentation.
My objective is to generate a python plug-in for QGIS that will open a CSV and define a field within the table to display as a map tip.
I'm trying to achieve this task and have got stuck on trying to set the layer properties using python, rather than opening the 'layer properties' dialog, selecting the Display tab and entering HTML expression...
the HTML expression I'm trying to insert into the layer properties is:
field1= '<b>\"title\"</b><br/>\n'+'[%CONCAT(\'<img src=\"\',\"file\",\'\" width=\"400\"></img>\')%]'
where "title" and "file" are fields within the CSV, giving rise to:
<b>"title"</b><br/>
[%CONCAT('<img src="',"file",'" width="400"></img>')%]
This gives me the right HTML to slot into a relevant place - and it works when I use this manually, but I'm now lost trying to find how to change the layer properties using python...
There seems to be a function called
setDisplayAttributes but I can't really follow the API description well enough to understand whether it is the correct function and I can't find any examples using this function.
Any help would be appreciated - I'm a toddler with Python but probably pre-pubescent with QGIS (Version 2.8 on Windows 10) so if you are able to work in words of less than 47 syllables that would be grand.
Many thanks in advance.
EDIT: I've realised this might not be the right place for this
question so have posted on GIS.stackexchange. My apologies and I will
update whichever one gets answered so that folk can find it. If you
choose to vote this down for my stupidity, so be it.
You can find the other version here:
https://gis.stackexchange.com/questions/169997/qgis-layer-import-csv-and-set-display-html-map-tip-using-python