pwang7 / rebook

96 stars 11 forks source link

Width and Height cannot be inserted as keyboard input #3

Open edo0 opened 4 years ago

edo0 commented 4 years ago

As the title says, unfortunately the height and width cannot be set to custom values by means of keyboard input, but only increased +-0.1 at a time using the up and down arrows. Would there be a chance to fix this, or find a workaround to increase or decrease pixel width and height by more units at a time? Thank you!

I am running rebook on Arch Linux, latest edition of all packages

kmtm commented 3 years ago

It's been a while, but for anyone running into the same issue...

As a workaround I went into the .py file and changed the line that gives the defaults to what I wanted instead of using the annoying arrows. I'm on MacOS, but search for: width_arg_name until you get here:

default_var_map = {
    device_arg_name:                    ['Kindle 1-5'],
    screen_unit_prefix:                 ['Pixels'],
    width_arg_name:                     ['6.2'],
    height_arg_name:                    ['8.26'],

I just adjusted the #s here to the inches I wanted.

R-e-d-J commented 3 years ago

Another workaround is to comment the line : state='readonly',

For exemple (about line 520) :

widthTextLabel = Label(requiredInputFrame, text='Width')
widthTextLabel.grid(
    column=0,
    row=required_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)

widthSpinBox = Spinbox(
    requiredInputFrame,
    from_=0,
    to=10000,
    increment=0.1,
    # state='readonly',   #                              <== comment this line for the width
    textvariable=strvarScreenWidth,
    command=on_command_width_height_cb,
)
widthSpinBox.grid(
    column=1,
    row=required_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)

required_frame_row_num += 1

heightTextLabel = Label(requiredInputFrame, text='Height')
heightTextLabel.grid(
    column=0,
    row=required_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)
heightSpinBox = Spinbox(
    requiredInputFrame,
    from_=0,
    to=10000,
    increment=0.1,
    # state='readonly',   #                              <== comment this line for the height
    textvariable=strvarScreenHeight,
    command=on_command_width_height_cb,
)

B U T I think that pwang7 have set the state to readonly to be sure that the value is a numeric value (between 0 and 10,000) without need to set test to check the content of field. So if you use this workaround you need to be very careful with the values you use !