Skip to content

Commit

Permalink
remove pass column of knit progress in Single Bed mode
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mpr1c3 authored and dl1com committed Oct 17, 2023
1 parent 6072855 commit df1111e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/main/python/ayab/knitprogress.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# https://github.com/AllYarnsAreBeautiful/ayab-desktop

from PyQt5.QtCore import Qt, QCoreApplication, QRect, QSize
from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem, QLabel, QSizePolicy, QAbstractItemView, QWidget, QHBoxLayout
from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem, QLabel, QSizePolicy, QAbstractItemView, QWidget, QHBoxLayout, QHeaderView
from bitarray import bitarray

from . import utils
Expand All @@ -39,10 +39,9 @@ def __init__(self, parent):
super().__init__(parent.ui.graphics_splitter)
self.clear()
self.setRowCount(0)
self.setStyleSheet("border-width: 0;")
self.setGeometry(QRect(0, 0, 700, 220))
self.setContentsMargins(1, 1, 1, 1)
self.verticalHeader().setDefaultSectionSize(16)
self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
self.verticalHeader().setVisible(False)
self.blank = QTableWidgetItem()
self.blank.setSizeHint(QSize(0, 0))
Expand Down Expand Up @@ -115,15 +114,15 @@ def update(self, status, row_multiplier, midline, auto_mirror):
status.bits.reverse()
midline = len(status.bits) - midline

table_text = "<table style='cell-spacing: 1; cell-padding: 1; background-color: #{:06x};'><tr> ".format(
table_text = "<table style='cell-spacing: 1; cell-padding: 1; background-color: #{:06x};'><tr>".format(
self.orange)
for c in range(0, midline):
table_text += self.__stitch(status.color, status.bits[c],
status.alt_color)
table_text += "</tr></table>"
left_side = QLabel(table_text)

table_text = "<table style='cell-spacing: 1; cell-padding: 1; background-color: #{:06x};'><tr> ".format(
table_text = "<table style='cell-spacing: 1; cell-padding: 1; background-color: #{:06x};'><tr>".format(
self.green)
for c in range(midline, len(status.bits)):
table_text += self.__stitch(status.color, status.bits[c],
Expand All @@ -137,8 +136,10 @@ def update(self, status, row_multiplier, midline, auto_mirror):
n_cols = len(columns)
self.setCellWidget(0, n_cols, left_side)
self.setCellWidget(0, n_cols + 1, right_side)
if row_multiplier == 1:
self.hideColumn(1)
if n_cols < 4:
self.horizontalHeader().hideSection(5)
self.hideColumn(5)
self.resizeColumnsToContents()

self.previousStatus = status
Expand All @@ -147,20 +148,18 @@ def update(self, status, row_multiplier, midline, auto_mirror):
self.scene.row_progress = status.current_row

def __item(self, text):
table = "<table><tr><td>" + text + "</td></tr></table>"
item = QTableWidgetItem(text)
return item

def __stitch(self, color, bit, alt_color=None):
# FIXME: borders are not visible
text = "<td width='12' style='"
text = "<td width='12' style='border: 1 black "
if bit:
text += "border: 1 solid black; background-color: #{:06x};".format(
text += "solid; background-color: #{:06x};".format(
color)
elif alt_color is not None:
text += "border: 1 solid black; background-color: #{:06x};".format(
text += "solid; background-color: #{:06x};".format(
alt_color)
else:
text += "border: 1 dotted black;"
text += "'/>"
return text
text += "dotted;"
return text + "'/>"

0 comments on commit df1111e

Please sign in to comment.