QTableView data disapears by opening another QTableView - python

I have an application developed in Python using PyQt4, In which i used QTableView to display a reports.
when i open one report window with QTableView it shows the result properly.
If i open another report window with QTableView it shows the result properly.
Now both the windows are displaying the data in there QTableViews.
Now the issue is, When i select the 1st report window the data in it is disappearing.
Can anyone tell me exactly whats wrong i am doing.

Check if you are using same instance of QtSql.QSqlDatabase for all the views you create.

Related

How to put excel window upfront in xlwings?

How can I put excel window in front of other apps in terms of visibility? I am not interested in making it visible in visible=True attribute of App, because I can only see the excel window in taskbar. I need to see it in front of me (on top of other apps), so I can use pyautogui.
app = xw.App(add_book=False)
api_wb = app.books.api.Open(file_directory, UpdateLinks=False)
wb = xw.Book(impl=xw._xlwindows.Book(xl=api_wb))
A sample of the code is here. Although any other method of opening file will result in the same excel being wrapped to taskbar.
How can I solve this?
I also wanted to upload an image of the issue, but stackoverflow didn't let me saying: 'An error occurred when uploading the image: Service Unavailable'. The image format is .png
You need to activate the app and steal the focus like this:
app.activate(steal_focus=True)
see: https://docs.xlwings.org/en/stable/api.html#xlwings.App.activate

Hide bottom HTML/widget, and remove Drag & Drop from Streamlit file_uploader()

I´ve created an app using Streamlit, which needs to read multiple files at once. I´m using the file_uploader() component with the parameter accept_multiple_files=True.
I got 2 questions:
First is if there´s a way to hide the bottom HTML/Widget that appears after uploading a file/s (see picture below)?
And second, if there´s a way to remove the drag&drop option, just leaving "Browse Files" toggle button?
The best solution currently is using the st.beta_expander() to hide the st.file_uploader() without having to programmatically play with the rerunning script to see if files were added. So for example in my problem it would be something like:
with st.beta_expander("Upload DICOM Files"):
uploaded_files = st.file_uploader("Select DICOM Files:",
accept_multiple_files=True,
type='dcm')
More info about the st.beta_expander() and what can be done with it here.

Is there a PyQt5 widget for drop-down "file explorer" menu?

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.

PyQt QTreeWidgetItem Individual windows with individual data.

I have a QTreeWidget that contains rows of data for multiple students. When double clicking on a row, a window opens, with a number of drop down menus and text edits that a user can input into. Currently, the user can open the file menu in the top left corner of that window and save the file manually in a folder from there and also open it, but this is inefficient for my program, and I want to make it so that each individual student in the QTreeWidget will have their own individual window open up, that, when a save button is pressed in the window, the data within the window will save within a database of some sort, and when that student's window is opened again, the information inputted specifically in the window and saved earlier for that student will load up automatically.
The QTreeWidget looks something like this (ignore the issue with the scroll bar in the corner. Names have been censored for data protection):
QTreeWidget
And the window containing user inputted data looks like so:
Popup Window
If there are any documentations or tutorials that could help me with this issue, I'd love to know, because I can't seem to find anything related to this anywhere. Even any basic ideas on how I could go about introducing this function into my program would be of great help. I am using Python 3.4 and MySql.
Why don't you start with studying how the standard MVC is implemented in Qt?
The following resources should be a good start for you:
this intro site
or this video series

Adding multiple icons in QComboBox with QAbstractItemDelegate pyqt

I wanted to set multiple icons in a single item in my QcomboBox. I think this can be implemented using the QAbstractItemDelegate, but I need some PyQt examples. The following link does give me an idea but I couldn't get in running with Python :
How to custome QCombobox with multiple comlumns
Thank you for the help.

Categories

Resources