Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 05-26-2023, 03:24 AM   #1
otakutyrant
Member
otakutyrant began at the beginning.
 
Posts: 13
Karma: 10
Join Date: May 2023
Device: Kindle
My configwidget looks too large.

What should I do? The source code is https://github.com/otakutyrant/new_w...main/config.py
Attached Thumbnails
Click image for larger version

Name:	2023-05-26-152332_2139x1080_scrot.png
Views:	103
Size:	191.5 KB
ID:	201688  
otakutyrant is offline   Reply With Quote
Old 05-26-2023, 03:25 AM   #2
otakutyrant
Member
otakutyrant began at the beginning.
 
Posts: 13
Karma: 10
Join Date: May 2023
Device: Kindle
I have tried self.setGeometry, but it seems do not work.
otakutyrant is offline   Reply With Quote
Advert
Old 05-26-2023, 01:09 PM   #3
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
Quote:
Originally Posted by otakutyrant View Post
What should I do? The source code is https://github.com/otakutyrant/new_w...main/config.py

Wrong subforum. A Moderator should move your thread to the Calibre > Development subforum.





DaltonST
DaltonST is offline   Reply With Quote
Old 05-26-2023, 10:51 PM   #4
Bradles
Connoisseur
Bradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmosBradles has become one with the cosmos
 
Bradles's Avatar
 
Posts: 70
Karma: 21074
Join Date: Nov 2020
Location: Perth, Western Australia
Device: Apple Books & Kobo Libra H20
I have never used a GridLayout before, but I think a HBoxLayout in a VBoxLayout and a stretch on the end would do the trick. I'm no expert by any means.

Here's one I prepared earlier ;-):

Spoiler:
Code:
LABEL_WIDTH = 100
class ConfigWidget(QWidget):

    def __init__(self):

        QWidget.__init__(self)

        self.l = QVBoxLayout()
        self.setLayout(self.l)

        groupBox = QGroupBox(_("OpenAI API"))
        self.l.addWidget(groupBox)

        groupBox_vlayout = QVBoxLayout()
        groupBox.setLayout (groupBox_vlayout)


        # # # API URL # # #
        # H Layout
        apilayout = QHBoxLayout()
        groupBox_vlayout.addLayout(apilayout)

        # API label
        apilabel = QLabel(_('API &URL:'))
        apilabel.setMinimumWidth(LABEL_WIDTH)
        apilayout.addWidget(apilabel)

        # API edit
        self.apiedit = QLineEdit(self)
        self.apiedit.setText(prefs['api-url'])
        self.apiedit.setToolTip(_("This is the proxy to the backend API. You do not need to change this."))
        apilayout.addWidget(self.apiedit)
        apilabel.setBuddy(self.apiedit)
        apilabel.setToolTip(self.apiedit.toolTip())
        self.apiedit.setEnabled(False)


        # # # LANGUAGE # # #
        # H Layout
        langlayout = QHBoxLayout()
        groupBox_vlayout.addLayout(langlayout)

        # Language label
        langlabel = QLabel(_('&Language:'))
        langlabel.setMinimumWidth(LABEL_WIDTH)
        langlayout.addWidget(langlabel)

        # Language edit
        self.langedit = QLineEdit(self)
        self.langedit.setText(prefs['language'])
        self.langedit.setToolTip(_("The language in which to return results, e.g. English, Spanish, German, Klingon..."))
        langlayout.addWidget(self.langedit)
        langlabel.setBuddy(self.langedit)
        langlabel.setToolTip(self.langedit.toolTip())


        # # # MAX TOKENS # # #
        # H Layout
        maxlayout = QHBoxLayout()
        groupBox_vlayout.addLayout(maxlayout)

        # Max Length label
        maxtokenslabel = QLabel(_('&Max length:'))
        maxtokenslabel.setMinimumWidth(LABEL_WIDTH)
        maxlayout.addWidget(maxtokenslabel)

        # Max Length edit
        self.maxlength = QLineEdit(self)
        validator = QIntValidator(1, 2000, self)
        # the  lineedit SHOULD only accept integers between 1 and 2000, but actually accepts 9999!
        self.maxlength.setValidator(validator)
        self.maxlength.setText(prefs['max-length'])
        self.maxlength.setToolTip(_("The maximum length in tokens, where 1000 tokens is about 750 words."))
        maxlayout.addWidget(self.maxlength)
        maxtokenslabel.setBuddy(self.maxlength)        
        maxtokenslabel.setToolTip(self.maxlength.toolTip())


        # # # TEMPERATURE # # #
        # H Layout
        templayout = QHBoxLayout()
        groupBox_vlayout.addLayout(templayout)

        # Temperature label
        templabel = QLabel(_('&Temperature:'))
        templabel.setMinimumWidth(LABEL_WIDTH)
        templayout.addWidget(templabel)

        # Temperature slider (save as float in range 0.00:2.00)
        self.tempslider = QSlider(self)
        self.tempslider.setOrientation(Qt.Horizontal)
        self.tempslider.setMinimum(0)
        self.tempslider.setMaximum(200)
        self.tempslider.setToolTip(_("Control the randomness of results, where lower numbers are less random."))
        templayout.addWidget(self.tempslider)
        templabel.setBuddy(self.tempslider)        
        templabel.setToolTip(self.tempslider.toolTip())

        # Temperature value (updated in response to slider changing)
        self.tempvalue = QLabel()
        templayout.addWidget(self.tempvalue)

        # make sure above layouts align to the top
        groupBox_vlayout.addStretch()

        # do this last so tempvalue is ready to go
        self.tempslider.valueChanged.connect(self.temp_value_changed)
        self.tempslider.setValue(int(100 * float(prefs['temperature'])))
Bradles is offline   Reply With Quote
Old 06-11-2023, 10:54 AM   #5
otakutyrant
Member
otakutyrant began at the beginning.
 
Posts: 13
Karma: 10
Join Date: May 2023
Device: Kindle
Quote:
Originally Posted by Bradles View Post
I have never used a GridLayout before, but I think a HBoxLayout in a VBoxLayout and a stretch on the end would do the trick. I'm no expert by any means.
@Bradles Thank you for you advice! I found out the main issue was induced by the bad behaviour of my titling windows i3. I manualy resized the floating configwidget and it looks well now.
otakutyrant is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Too large font? errenay Kobo Reader 13 01-28-2023 04:42 AM
Large images JSWolf Feedback 37 03-27-2016 04:56 PM
Large stopgap ereader with large fonts renushan Which one should I buy? 2 08-16-2012 01:49 AM
Catalog too large bcarlson Library Management 6 01-16-2011 08:40 AM
Large ebooks plaid Kobo Reader 6 06-02-2010 05:42 PM


All times are GMT -4. The time now is 12:47 AM.


MobileRead.com is a privately owned, operated and funded community.