本文整理汇总了Python中PyQt4.Qt.QScrollArea.setWidgetResizable方法的典型用法代码示例。如果您正苦于以下问题:Python QScrollArea.setWidgetResizable方法的具体用法?Python QScrollArea.setWidgetResizable怎么用?Python QScrollArea.setWidgetResizable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QScrollArea
的用法示例。
在下文中一共展示了QScrollArea.setWidgetResizable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: config_widget
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
def config_widget(cls):
from PyQt4.Qt import QCoreApplication
from PyQt4.Qt import QScrollArea
cw = super(KOBOTOUCHEXTENDED, cls).config_widget()
qsa = QScrollArea()
qsa.setWidgetResizable(True)
qsa.setWidget(cw)
qsa.validate = cw.validate
desktop_geom = QCoreApplication.instance().desktop().availableGeometry()
if desktop_geom.height() < 800:
qsa.setBaseSize(qsa.size().width(), desktop_geom.height() - 100)
return qsa
示例2: PluginObject
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
class PluginObject(object):
tabName = 'Armory Search'
maxVersion = '0.93.99'
#############################################################################
def __init__(self, main):
def searchItem():
searchString = str(self.searchEntry.text())
if len(searchString) > 0:
likelyDataType = isLikelyDataType(searchString)
for wltID, wlt in self.main.walletMap.iteritems():
if wlt.hasAddr(searchString):
searchHash = searchString if likelyDataType == DATATYPE.Hex \
else addrStr_to_hash160(searchString)[1]
dialog = DlgAddressInfo(wlt, searchHash, main=self.main)
dialog.exec_()
break
if likelyDataType == DATATYPE.Hex:
walletLedger = wlt.cppWallet.getTxLedger()
txHashToFind = hex_to_binary(searchString, endOut=BIGENDIAN)
txFound = False
for entry in walletLedger:
if entry.getTxHash() == txHashToFind:
cppTx = TheBDM.getTxByHash(txHashToFind)
serializedCppTx = cppTx.serialize()
pytx = PyTx().unserialize(serializedCppTx)
DlgDispTxInfo(pytx, wlt, self.main, self.main).exec_()
txFound = True
break
if txFound:
break
self.main = main
lblHeader = QRichLabel(tr("""<b>Search Armory: </b>"""), doWrap=False)
self.searchButton = QPushButton("Search")
self.searchEntry = QLineEdit()
self.main.connect(self.searchButton, SIGNAL('clicked()'), searchItem)
topRow = makeHorizFrame([lblHeader, self.searchEntry, self.searchButton, 'stretch'])
self.searchPanel = makeVertFrame([topRow, 'stretch' ])
# Now set the scrollarea widget to the layout
self.tabToDisplay = QScrollArea()
self.tabToDisplay.setWidgetResizable(True)
self.tabToDisplay.setWidget(self.searchPanel)
#############################################################################
def getTabToDisplay(self):
return self.tabToDisplay
示例3: PluginObject
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
class PluginObject(object):
tabName = 'Armory Log'
maxVersion = '0.93.99'
#############################################################################
def __init__(self, main):
self.main = main
def updateLogDisplay():
self.pyLogTextDisplay.setText(getLastBytesOfFile(ARMORY_LOG_FILE))
self.pyLogTextDisplay.moveCursor(QtGui.QTextCursor.End)
self.cppLogTextDisplay.setText(getLastBytesOfFile(ARMCPP_LOG_FILE))
self.cppLogTextDisplay.moveCursor(QtGui.QTextCursor.End)
lblHeader = QRichLabel(tr("""<b>Log File Display</b>"""), doWrap=False)
self.updateButton = QPushButton("Update")
self.main.connect(self.updateButton, SIGNAL('clicked()'), updateLogDisplay)
topRow = makeHorizFrame([lblHeader, self.updateButton, 'stretch'])
self.pyLogTextDisplay = self.createLogDisplay()
self.cppLogTextDisplay = self.createLogDisplay()
logTabPanel = QTabWidget()
logTabPanel.addTab(self.pyLogTextDisplay, "Python Log")
logTabPanel.addTab(self.cppLogTextDisplay, "C++ Log")
self.logFrame = makeVertFrame([topRow, logTabPanel ])
# Now set the scrollarea widget to the layout
self.tabToDisplay = QScrollArea()
self.tabToDisplay.setWidgetResizable(True)
self.tabToDisplay.setWidget(self.logFrame)
updateLogDisplay()
def createLogDisplay(self):
logTextDisplay = QTextEdit()
logTextDisplay.setFont(GETFONT('Fixed', 8))
w,h = relaxedSizeNChar(logTextDisplay, 68)[0], int(12 * 8.2)
logTextDisplay.setMinimumWidth(w)
logTextDisplay.setMinimumHeight(h)
logTextDisplay.setReadOnly(True)
return logTextDisplay
#############################################################################
def getTabToDisplay(self):
return self.tabToDisplay
示例4: Ui_PartWindow
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
#.........这里部分代码省略.........
# minor vsplitter resizing problem I was trying to resolve a few
# months ago? Try supplying a parent later. Mark 2008-01-01
self.pwProjectTabWidget.setObjectName("pwProjectTabWidget")
self.pwProjectTabWidget.setCurrentIndex(0)
self.pwProjectTabWidget.setAutoFillBackground(True)
# Create the model tree "tab" widget. It will contain the MT GUI widget.
# Set the tab icon, too.
self.modelTreeTab = QWidget()
self.modelTreeTab.setObjectName("modelTreeTab")
self.pwProjectTabWidget.addTab(
self.modelTreeTab,
geticon("ui/modeltree/Model_Tree.png"),
"")
modelTreeTabLayout = QVBoxLayout(self.modelTreeTab)
modelTreeTabLayout.setMargin(0)
modelTreeTabLayout.setSpacing(0)
# Create the model tree (GUI) and add it to the tab layout.
self.modelTree = modelTree(self.modelTreeTab, parent)
self.modelTree.modelTreeGui.setObjectName("modelTreeGui")
modelTreeTabLayout.addWidget(self.modelTree.modelTreeGui)
# Create the property manager "tab" widget. It will contain the PropMgr
# scroll area, which will contain the property manager and all its
# widgets.
self.propertyManagerTab = QWidget()
self.propertyManagerTab.setObjectName("propertyManagerTab")
self.propertyManagerScrollArea = QScrollArea(self.pwProjectTabWidget)
self.propertyManagerScrollArea.setObjectName("propertyManagerScrollArea")
self.propertyManagerScrollArea.setWidget(self.propertyManagerTab)
self.propertyManagerScrollArea.setWidgetResizable(True)
# Eureka!
# setWidgetResizable(True) will resize the Property Manager (and its
# contents) correctly when the scrollbar appears/disappears.
# It even accounts correctly for collapsed/expanded groupboxes!
# Mark 2007-05-29
# Add the property manager scroll area as a "tabbed" widget.
# Set the tab icon, too.
self.pwProjectTabWidget.addTab(
self.propertyManagerScrollArea,
geticon("ui/modeltree/Property_Manager.png"),
"")
# Finally, add the "pwProjectTabWidget" to the left channel layout.
leftChannelVBoxLayout.addWidget(self.pwProjectTabWidget)
# Create the glpane and make it a child of the part splitter.
self.glpane = GLPane(assy, self, 'glpane name', parent)
# note: our owner (MWsemantics) assumes
# there is just this one GLPane for assy, and stores it
# into assy as assy.o and assy.glpane. [bruce 080216 comment]
self.pwProjectTabWidget.KLUGE_setGLPane(self.glpane)
# help fix bug 2522 [bruce 070829]
qt4warnDestruction(self.glpane, 'GLPane of PartWindow')
pwSplitter.addWidget(self.glpane)
# ##################################################################
# <pwBottomArea> is a container at the bottom of the part window
# spanning its entire width. It is intended to be used as an extra
# area for use by Property Managers (or anything else) that needs
# a landscape oriented layout.
# An example is the Sequence Editor, which is part of the
示例5: Preferences
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
class Preferences(QMainWindow):
run_wizard_requested = pyqtSignal()
def __init__(self, gui, initial_plugin=None, close_after_initial=False):
QMainWindow.__init__(self, gui)
self.gui = gui
self.must_restart = False
self.committed = False
self.close_after_initial = close_after_initial
self.resize(930, 720)
nh, nw = min_available_height()-25, available_width()-10
if nh < 0:
nh = 800
if nw < 0:
nw = 600
nh = min(self.height(), nh)
nw = min(self.width(), nw)
self.resize(nw, nh)
self.esc_action = QAction(self)
self.addAction(self.esc_action)
self.esc_action.setShortcut(QKeySequence(Qt.Key_Escape))
self.esc_action.triggered.connect(self.esc)
geom = gprefs.get('preferences_window_geometry', None)
if geom is not None:
self.restoreGeometry(geom)
# Center
if islinux:
self.move(gui.rect().center() - self.rect().center())
self.setWindowModality(Qt.WindowModal)
self.setWindowTitle(__appname__ + ' - ' + _('Preferences'))
self.setWindowIcon(QIcon(I('config.png')))
self.status_bar = StatusBar(self)
self.setStatusBar(self.status_bar)
self.stack = QStackedWidget(self)
self.cw = QWidget(self)
self.cw.setLayout(QVBoxLayout())
self.cw.layout().addWidget(self.stack)
self.bb = QDialogButtonBox(QDialogButtonBox.Close)
self.wizard_button = self.bb.addButton(_('Run welcome wizard'),
self.bb.ActionRole)
self.wizard_button.setIcon(QIcon(I('wizard.png')))
self.wizard_button.clicked.connect(self.run_wizard,
type=Qt.QueuedConnection)
self.cw.layout().addWidget(self.bb)
self.bb.button(self.bb.Close).setDefault(True)
self.bb.rejected.connect(self.close, type=Qt.QueuedConnection)
self.setCentralWidget(self.cw)
self.browser = Browser(self)
self.browser.show_plugin.connect(self.show_plugin)
self.stack.addWidget(self.browser)
self.scroll_area = QScrollArea(self)
self.stack.addWidget(self.scroll_area)
self.scroll_area.setWidgetResizable(True)
self.bar = QToolBar(self)
self.addToolBar(self.bar)
self.bar.setVisible(False)
self.bar.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
self.bar.setMovable(False)
self.bar.setFloatable(False)
self.bar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
self.apply_action = self.bar.addAction(QIcon(I('ok.png')), _('&Apply'),
self.commit)
self.cancel_action = self.bar.addAction(QIcon(I('window-close.png')),
_('&Cancel'), self.cancel)
self.bar_title = BarTitle(self.bar)
self.bar.addWidget(self.bar_title)
self.restore_action = self.bar.addAction(QIcon(I('clear_left.png')),
_('Restore &defaults'), self.restore_defaults)
for ac, tt in [('apply', _('Save changes')),
('cancel', _('Cancel and return to overview'))]:
ac = getattr(self, ac+'_action')
ac.setToolTip(tt)
ac.setWhatsThis(tt)
ac.setStatusTip(tt)
for ch in self.bar.children():
if isinstance(ch, QToolButton):
ch.setCursor(Qt.PointingHandCursor)
ch.setAutoRaise(True)
self.stack.setCurrentIndex(0)
if initial_plugin is not None:
category, name = initial_plugin
plugin = get_plugin(category, name)
if plugin is not None:
self.show_plugin(plugin)
def run_wizard(self):
self.close()
self.run_wizard_requested.emit()
#.........这里部分代码省略.........
示例6: do_layout
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
def do_layout(self):
self.central_widget.clear()
self.labels = []
sto = QWidget.setTabOrder
self.central_widget.tabBar().setVisible(False)
tab0 = QWidget(self)
self.central_widget.addTab(tab0, _("&Metadata"))
l = QGridLayout()
tab0.setLayout(l)
# Basic metadata in col 0
tl = QGridLayout()
gb = QGroupBox(_('Basic metadata'), tab0)
l.addWidget(gb, 0, 0, 1, 1)
gb.setLayout(tl)
self.button_box_layout.insertWidget(1, self.fetch_metadata_button)
self.button_box_layout.insertWidget(2, self.config_metadata_button)
sto(self.button_box, self.fetch_metadata_button)
sto(self.fetch_metadata_button, self.config_metadata_button)
sto(self.config_metadata_button, self.title)
def create_row(row, widget, tab_to, button=None, icon=None, span=1):
ql = BuddyLabel(widget)
tl.addWidget(ql, row, 1, 1, 1)
tl.addWidget(widget, row, 2, 1, 1)
if button is not None:
tl.addWidget(button, row, 3, span, 1)
if icon is not None:
button.setIcon(QIcon(I(icon)))
if tab_to is not None:
if button is not None:
sto(widget, button)
sto(button, tab_to)
else:
sto(widget, tab_to)
tl.addWidget(self.swap_title_author_button, 0, 0, 2, 1)
tl.addWidget(self.manage_authors_button, 2, 0, 2, 1)
tl.addWidget(self.paste_isbn_button, 12, 0, 1, 1)
tl.addWidget(self.tags_editor_button, 6, 0, 1, 1)
create_row(0, self.title, self.title_sort,
button=self.deduce_title_sort_button, span=2,
icon='auto_author_sort.png')
create_row(1, self.title_sort, self.authors)
create_row(2, self.authors, self.author_sort,
button=self.deduce_author_sort_button,
span=2, icon='auto_author_sort.png')
create_row(3, self.author_sort, self.series)
create_row(4, self.series, self.series_index,
button=self.clear_series_button, icon='trash.png')
create_row(5, self.series_index, self.tags)
create_row(6, self.tags, self.rating, button=self.clear_tags_button)
create_row(7, self.rating, self.pubdate, button=self.clear_ratings_button)
create_row(8, self.pubdate, self.publisher,
button=self.pubdate.clear_button, icon='trash.png')
create_row(9, self.publisher, self.languages)
create_row(10, self.languages, self.timestamp)
create_row(11, self.timestamp, self.identifiers,
button=self.timestamp.clear_button, icon='trash.png')
create_row(12, self.identifiers, self.comments,
button=self.clear_identifiers_button, icon='trash.png')
sto(self.clear_identifiers_button, self.swap_title_author_button)
sto(self.swap_title_author_button, self.manage_authors_button)
sto(self.manage_authors_button, self.tags_editor_button)
sto(self.tags_editor_button, self.paste_isbn_button)
tl.addItem(QSpacerItem(1, 1, QSizePolicy.Fixed, QSizePolicy.Expanding),
13, 1, 1 ,1)
# Custom metadata in col 1
w = getattr(self, 'custom_metadata_widgets_parent', None)
if w is not None:
gb = QGroupBox(_('Custom metadata'), tab0)
gbl = QVBoxLayout()
gb.setLayout(gbl)
sr = QScrollArea(gb)
sr.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
sr.setWidgetResizable(True)
sr.setFrameStyle(QFrame.NoFrame)
sr.setWidget(w)
gbl.addWidget(sr)
l.addWidget(gb, 0, 1, 1, 1)
sp = QSizePolicy()
sp.setVerticalStretch(10)
sp.setHorizontalPolicy(QSizePolicy.Minimum)
sp.setVerticalPolicy(QSizePolicy.Expanding)
gb.setSizePolicy(sp)
self.set_custom_metadata_tab_order()
# comments span col 0 & 1
w = QGroupBox(_('Comments'), tab0)
sp = QSizePolicy()
sp.setVerticalStretch(10)
sp.setHorizontalPolicy(QSizePolicy.Expanding)
sp.setVerticalPolicy(QSizePolicy.Expanding)
w.setSizePolicy(sp)
lb = QHBoxLayout()
w.setLayout(lb)
#.........这里部分代码省略.........
示例7: MetadataSingleDialogBase
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
class MetadataSingleDialogBase(ResizableDialog):
view_format = pyqtSignal(object, object)
cc_two_column = tweaks['metadata_single_use_2_cols_for_custom_fields']
one_line_comments_toolbar = False
use_toolbutton_for_config_metadata = True
def __init__(self, db, parent=None):
self.db = db
self.changed = set()
self.books_to_refresh = set()
self.rows_to_refresh = set()
ResizableDialog.__init__(self, parent)
def setupUi(self, *args): # {{{
self.resize(990, 670)
self.download_shortcut = QShortcut(self)
self.download_shortcut.setKey(QKeySequence('Ctrl+D',
QKeySequence.PortableText))
p = self.parent()
if hasattr(p, 'keyboard'):
kname = u'Interface Action: Edit Metadata (Edit Metadata) : menu action : download'
sc = p.keyboard.keys_map.get(kname, None)
if sc:
self.download_shortcut.setKey(sc[0])
self.button_box = bb = QDialogButtonBox(self)
self.button_box.accepted.connect(self.accept)
self.button_box.rejected.connect(self.reject)
self.next_button = QPushButton(QIcon(I('forward.png')), _('Next'),
self)
self.next_button.setShortcut(QKeySequence('Alt+Right'))
self.next_button.clicked.connect(self.next_clicked)
self.prev_button = QPushButton(QIcon(I('back.png')), _('Previous'),
self)
self.prev_button.setShortcut(QKeySequence('Alt+Left'))
self.button_box.addButton(self.prev_button, bb.ActionRole)
self.button_box.addButton(self.next_button, bb.ActionRole)
self.prev_button.clicked.connect(self.prev_clicked)
bb.setStandardButtons(bb.Ok|bb.Cancel)
bb.button(bb.Ok).setDefault(True)
self.scroll_area = QScrollArea(self)
self.scroll_area.setFrameShape(QScrollArea.NoFrame)
self.scroll_area.setWidgetResizable(True)
self.central_widget = QTabWidget(self)
self.scroll_area.setWidget(self.central_widget)
self.l = QVBoxLayout(self)
self.setLayout(self.l)
self.l.addWidget(self.scroll_area)
ll = self.button_box_layout = QHBoxLayout()
self.l.addLayout(ll)
ll.addSpacing(10)
ll.addWidget(self.button_box)
self.setWindowIcon(QIcon(I('edit_input.png')))
self.setWindowTitle(BASE_TITLE)
self.create_basic_metadata_widgets()
if len(self.db.custom_column_label_map):
self.create_custom_metadata_widgets()
self.do_layout()
geom = gprefs.get('metasingle_window_geometry3', None)
if geom is not None:
self.restoreGeometry(bytes(geom))
# }}}
def create_basic_metadata_widgets(self): # {{{
self.basic_metadata_widgets = []
self.languages = LanguagesEdit(self)
self.basic_metadata_widgets.append(self.languages)
self.title = TitleEdit(self)
self.title.textChanged.connect(self.update_window_title)
self.deduce_title_sort_button = QToolButton(self)
self.deduce_title_sort_button.setToolTip(
_('Automatically create the title sort entry based on the current '
'title entry.\nUsing this button to create title sort will '
'change title sort from red to green.'))
self.deduce_title_sort_button.setWhatsThis(
self.deduce_title_sort_button.toolTip())
self.title_sort = TitleSortEdit(self, self.title,
self.deduce_title_sort_button, self.languages)
self.basic_metadata_widgets.extend([self.title, self.title_sort])
self.deduce_author_sort_button = b = QToolButton(self)
b.setToolTip('<p>' +
_('Automatically create the author sort entry based on the current '
'author entry. Using this button to create author sort will '
'change author sort from red to green. There is a menu of '
'functions available under this button. Click and hold '
'on the button to see it.') + '</p>')
b.m = m = QMenu()
ac = m.addAction(QIcon(I('forward.png')), _('Set author sort from author'))
#.........这里部分代码省略.........
示例8: PluginObject
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
#.........这里部分代码省略.........
mainLayout.addItem(QSpacerItem(15,15), i,0)
mainLayout.addWidget(self.lblSellLabel, i,1)
mainLayout.addWidget(self.lblSellPrice, i,2)
i+=1
mainLayout.addItem(QSpacerItem(15,15), i,0)
mainLayout.addWidget(self.lblBuyLabel, i,1)
mainLayout.addWidget(self.lblBuyPrice, i,2)
i+=1
mainLayout.addWidget(self.lblLastTime, i,0, 1,2)
mainLayout.addWidget(self.btnUpdate, i,2)
i+=1
mainLayout.addItem(QSpacerItem(20,20), i,0)
i+=1
mainLayout.addWidget(frmCalc, i,0, 1,3)
i+=1
mainLayout.addItem(QSpacerItem(30,30), i,0)
i+=1
mainLayout.addWidget(lblWltTableTitle, i,0, 1,3)
i+=1
mainLayout.addWidget(self.wltTable, i,0, 1,3)
mainLayout.setColumnStretch(0,0)
mainLayout.setColumnStretch(1,1)
mainLayout.setColumnStretch(2,1)
tabWidget = QWidget()
tabWidget.setLayout(mainLayout)
frmH = makeHorizFrame(['Stretch', tabWidget, 'Stretch'])
frm = makeVertFrame(['Space(20)', frmH, 'Stretch'])
# Now set the scrollarea widget to the layout
self.tabToDisplay = QScrollArea()
self.tabToDisplay.setWidgetResizable(True)
self.tabToDisplay.setWidget(frm)
#############################################################################
def getTabToDisplay(self):
return self.tabToDisplay
#############################################################################
def addCommasToPrice(self, pstr):
dispStr = pstr.strip().split('.')[0]
dispStr = ','.join([dispStr[::-1][3*i:3*(i+1)][::-1] \
for i in range((len(dispStr)-1)/3+1)][::-1])
if '.' in pstr:
dispStr = dispStr + '.' + pstr.split('.')[1]
return dispStr
#############################################################################
def fetchFormattedPrice(self, url):
sock = urllib2.urlopen(url)
value = ast.literal_eval(sock.read())['subtotal']['amount']
return self.addCommasToPrice(value)
#############################################################################
def checkUpdatePrice(self):
urlBase = 'http://coinbase.com/api/v1/prices/'
urlSell = urlBase + 'sell'
urlBuy = urlBase + 'buy'
示例9: PluginObject
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
#.........这里部分代码省略.........
self.main.connect(self.addOrderingButton, SIGNAL('clicked()'), addOrdering)
orderingButtonPanel = makeHorizFrame([segmentOrderingsHeader, self.addOrderingButton, 'stretch'])
self.segOrdListBox = QListWidget()
self.segOrdListBox.customContextMenuRequested.connect(self.showOrdContextMenu)
self.segOrdListBox.setContextMenuPolicy(Qt.CustomContextMenu)
self.searchButton = QPushButton("Search")
self.main.connect(self.searchButton, SIGNAL('clicked()'), searchForPassphrase)
self.stopButton = QPushButton("Stop Searching")
self.stopButton.setEnabled(False)
self.main.connect(self.stopButton, SIGNAL('clicked()'), endSearch)
totalSearchLabel = QRichLabel(tr("""<b>Total Passphrase Tries To Search: </b>"""), doWrap=False)
self.totalSearchTriesDisplay = QLineEdit()
self.totalSearchTriesDisplay.setReadOnly(True)
self.totalSearchTriesDisplay.setText(QString('0'))
self.totalSearchTriesDisplay.setFont(GETFONT('Fixed'))
self.totalSearchTriesDisplay.setMinimumWidth(tightSizeNChar(self.totalSearchTriesDisplay, 6)[0])
self.totalSearchTriesDisplay.setMaximumWidth(tightSizeNChar(self.totalSearchTriesDisplay, 12)[0])
searchButtonPanel = makeHorizFrame([self.searchButton, self.stopButton, 'stretch', totalSearchLabel, self.totalSearchTriesDisplay])
self.resultsDisplay = QTextEdit()
self.resultsDisplay.setReadOnly(True)
self.resultsDisplay.setFont(GETFONT('Fixed'))
self.resultsDisplay.setMinimumHeight(100)
self.searchPanel = makeVertFrame([topRow, self.segDefTableView, orderingButtonPanel,
self.segOrdListBox, searchButtonPanel, self.resultsDisplay, 'stretch'])
# Now set the scrollarea widget to the layout
self.tabToDisplay = QScrollArea()
self.tabToDisplay.setWidgetResizable(True)
self.tabToDisplay.setWidget(self.searchPanel)
def getSelectedWlt(self):
wlt = None
selectedWltList = self.main.walletsView.selectedIndexes()
if len(selectedWltList)>0:
row = selectedWltList[0].row()
wltID = str(self.main.walletsView.model().index(row, WLTVIEWCOLS.ID).data().toString())
wlt = self.main.walletMap[wltID]
return wlt
def showSegContextMenu(self):
menu = QMenu(self.segDefTableView)
if len(self.segDefTableView.selectedIndexes())==0:
return
row = self.segDefTableView.selectedIndexes()[0].row()
deleteSegMenuItem = menu.addAction("Delete Segment")
action = menu.exec_(QCursor.pos())
if action == deleteSegMenuItem:
self.deleteSegRow(row)
def showOrdContextMenu(self):
menu = QMenu(self.segOrdListBox)
if len(self.segOrdListBox.selectedItems())==0:
return
item = self.segOrdListBox.currentItem()
deleteOrdMenuItem = menu.addAction("Delete Ordering")
action = menu.exec_(QCursor.pos())
示例10: PluginObject
# 需要导入模块: from PyQt4.Qt import QScrollArea [as 别名]
# 或者: from PyQt4.Qt.QScrollArea import setWidgetResizable [as 别名]
#.........这里部分代码省略.........
privKeyMap[scrAddr] = addrObj.binPrivKey32_Plain.copy()
signedTx = PyCreateAndSignTx(utxiList,
[],
privKeyMap, SIGHASH_NONE|SIGHASH_ANYONECANPAY )
print "-------------"
print binary_to_hex(signedTx.serialize())
# sock = socket.create_connection(('dust-b-gone.bitcoin.petertodd.org',80))
# sock.send(signedTx.serialize())
# sock.send(b'\n')
# sock.close()
except socket.error as err:
QMessageBox.critical(self.main, tr('Negative Value'), tr("""
Failed to connect to dust-b-gone server: %s""" % err.strerror), QMessageBox.Ok)
except NegativeValueError:
QMessageBox.critical(self.main, tr('Negative Value'), tr("""
You must enter a positive value of at least 0.0000 0001
and less than %s for the dust limit.""" % MAX_DUST_LIMIT_STR), QMessageBox.Ok)
except TooMuchPrecisionError:
QMessageBox.critical(self.main.main, tr('Too much precision'), tr("""
Bitcoins can only be specified down to 8 decimal places.
The smallest unit of a Groestlcoin is 0.0000 0001 GRS.
Please enter a dust limit of at least 0.0000 0001 and less than %s.""" % MAX_DUST_LIMIT_STR), QMessageBox.Ok)
finally:
for scraddr in privKeyMap:
privKeyMap[scraddr].destroy()
self.main = main
self.lblHeader = QRichLabel(tr("""<b>Dust Outputs for Wallet: None Selected</b>"""), doWrap=False)
self.beGoneDustButton = QPushButton("Remove Dust")
self.beGoneDustButton.setEnabled(False)
self.main.connect(self.beGoneDustButton, SIGNAL('clicked()'), sendDust)
topRow = makeHorizFrame([self.lblHeader,'stretch'])
secondRow = makeHorizFrame([self.beGoneDustButton, 'stretch'])
self.dustLimitLabel = QLabel("Max Dust Value (GRS): ")
self.dustLimitText = QLineEdit()
self.dustLimitText.setFont(GETFONT('Fixed'))
self.dustLimitText.setMinimumWidth(tightSizeNChar(self.dustLimitText, 6)[0])
self.dustLimitText.setMaximumWidth(tightSizeNChar(self.dustLimitText, 12)[0])
self.dustLimitText.setAlignment(Qt.AlignRight)
self.dustLimitText.setText(coin2str(DEFAULT_DUST_LIMIT))
self.main.connect(self.dustLimitText, SIGNAL('textChanged(QString)'), updateDustLimit)
limitPanel = makeHorizFrame([self.dustLimitLabel, self.dustLimitText, 'stretch'])
self.dustTableModel = DustDisplayModel()
self.dustTableView = QTableView()
self.dustTableView.setModel(self.dustTableModel)
self.dustTableView.setSelectionMode(QTableView.NoSelection)
self.dustTableView.verticalHeader().setDefaultSectionSize(20)
self.dustTableView.verticalHeader().hide()
h = tightSizeNChar(self.dustTableView, 1)[1]
self.dustTableView.setMinimumHeight(2 * (1.3 * h))
self.dustTableView.setMaximumHeight(10 * (1.3 * h))
initialColResize(self.dustTableView, [100, .7, .3])
self.dustTableView.setContextMenuPolicy(Qt.CustomContextMenu)
self.lblTxioInfo = QRichLabel('')
self.lblTxioInfo.setMinimumWidth(tightSizeNChar(self.lblTxioInfo, 30)[0])
self.main.connect(self.main.walletsView, SIGNAL('clicked(QModelIndex)'),
updateDustLimit)
self.dustBGoneFrame = makeVertFrame([topRow, secondRow, limitPanel, self.dustTableView, 'stretch'])
# Now set the scrollarea widget to the layout
self.tabToDisplay = QScrollArea()
self.tabToDisplay.setWidgetResizable(True)
self.tabToDisplay.setWidget(self.dustBGoneFrame)
def getSelectedWlt(self):
wlt = None
selectedWltList = self.main.walletsView.selectedIndexes()
if len(selectedWltList)>0:
row = selectedWltList[0].row()
wltID = str(self.main.walletsView.model().index(row, WLTVIEWCOLS.ID).data().toString())
wlt = self.main.walletMap[wltID]
return wlt
#############################################################################
def getTabToDisplay(self):
return self.tabToDisplay
def injectShutdownFunc(self):
try:
self.main.writeSetting('DustLedgerCols', saveTableView(self.dustTableView))
except:
LOGEXCEPT('Strange error during shutdown')