When I started writing, regularly, for Miguel, I took it upon myself to cover legal cases. Since that time, I’ve learned more than I really wanted to about our justice system.
As my mentor used to say, “The justice system is just a system.” As a systems’ person, that allowed me to look at cases through the lens of my experience analyzing large systems.
One of the first things I noticed was that most people reporting on cases didn’t provide enough information for us to look up what was actually written or said.
CourtListener.com has come to my rescue for most legal filings in the federal system. If you know the court and the docket number you can find that case on CourtListener.
Once you have the docket located, you can start reading the filings. These are stored as PDFs. Most of my PDF tools allow me to copy and paste directly from the PDF.
What isn’t available on CourtListener is Supreme Court dockets. I’ve talked to Mike and others, the issue seems to be something about scrapping the Supreme Court website as well as other stuff. I’m not sure exactly what.
I want to be able to keep up on all the current cases in the Supreme Court, what their status currently is, what has been filed. They entirety of the case. I’m not concerned about most of the cases, but often it is easier to get all than a selected portion.
To this end, I have code that uses patterns to pull cases from the Supreme Court docket without have a listing of cases.
This tool will have search capabilities and other tools shortly, for now, it works well enough.
I am using the PySide6, which is a python implementation of the Qt framework. For the most part, I’m happy with this framework. There are parts I don’t like, which I work around.
My most recent success was figuring out how to allow me to click on hyperlinks in text to bring up my PDF viewer. This was not as simple as I wanted it to be, but it is working.
The other night, I wanted to write about a current case. I had the case docket in my tool. I pulled up the docket, clicked on the link, and John Roberts’ order popped up in my viewer, exactly as it should.
I started writing. Went to pull the quote and nothing.
Copy and paste does not seem to be functional in my tool.
Which takes me to the rant, which @#$)*&@$) coordinate system should I be using to get the right text!
Qt is built around widgets. Every widget has its coordinate system. In addition, there is the global coordinate system.
Each widget also has a paintEvent() which is when it paints itself.
To start the process, I capture mousePress, mouseMove, and mouseRelease events. While the mouse button is down, I draw a rectangle from the place clicked to the current location of the mouse.
I attempt to draw the rectangle and nothing shows up on the screen.
Through debugging code, I finally figured out that I am not updating the right widget.
The QPdfView widget properly renders the PDF document in a scrollable window. I have made a subclass of QPdfView so I am catching all paint events. But even though I’m telling the system that I have to redraw (update) my widget, there are no paint events being sent to my widget.
Turns out that my widget only cares about update signals that require the framing content be redrawn. I.e. if the scroll bar changes, then I get a paint event. Once I figured this out, I was able to tell the viewport that it should update and things started working.
So now I can draw a frame on the screen. But what I want is to get the text from within that frame.
I asked the QPdfDocument for a new selection from point_start to point_end. It tells me nothing is selected.
Where do I currently sit? I have my frame in my PDFViewer coordinate system. I have the PDF document in a different coordinate system. The PDF coordinate system is modified by the scroll bars or viewport. The scroll bars and scroll area modify the actual coordinate system of the viewport contents.
Somehow, I need to figure out which of these coordinate systems is the right coordinate system to use to get the text highlighted by my mouse.
I’m tired of this fight.
Leave a Reply