If unclicking doesn't work, you follow all steps of how to disassemble the K30 here:
Manual solenoid replacement Pentax K30 / Discharge flash-condenser / Solenoid choice - PentaxForums.com (If you want to give your K50 a good service to make it save for the future, then when you have solved the diopter problem leave it open,
buy a white Japan-solenoid and exchange it with the green gremlin which still sits in your K50 and might trouble you later. Don't be lazy and file/sand it, not a good idea!)
You need to get the back with the LCD off as well which is straight forward when you followed all other steps, no extra screws,
just 1 cable to unclick the back from the mainboard.
Then you follow those steps:
The lever M311 (=M306) clicks onto the metal part 0-M307.
From the service manual of the K-30 (100% similar here) 3 photos.
Photo 1 shows the front of the diopter with the 2 screws to unscrew
Photo 2 shows the front removed, one can see 0-M307
Photo 3 shows = parts list
Last edited by photogem; 08-11-2020 at 10:12 AM.