当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QGraphicsGridLayout类代码示例

本文整理汇总了Python中PyQt4.QtGui.QGraphicsGridLayout的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsGridLayout类的具体用法?Python QGraphicsGridLayout怎么用?Python QGraphicsGridLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QGraphicsGridLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, parent=None):
     QGraphicsWidget.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
     self.setContentsMargins(10, 10, 10, 10)
     layout = QGraphicsGridLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(10)
     self.setLayout(layout)
开发者ID:TimothyXie,项目名称:orange3,代码行数:8,代码来源:owimageviewer.py

示例2: layout_widgets

    def layout_widgets(self):
      # Layout
      if self.grid_layout <> None:
        del self.grid_layout
      self.grid_layout = QGraphicsGridLayout()
      header_layout = QGraphicsLinearLayout()
      header_layout.addItem(self.invert_button)
      header_layout.addItem(self.title_label)
      self.grid_layout.addItem(header_layout, 0, 0, 1, 2)
      #self.grid_layout.addItem(self.collapse_button, 0, 0)
      #self.grid_layout.addItem(self.title_label, 0, 1)
      self.grid_layout.addItem(self.from_label, 1, 0)
      self.grid_layout.addItem(self.currency_from, 1, 1)
      self.grid_layout.addItem(self.to_label, 2, 0)
      self.grid_layout.addItem(self.currency_to, 2, 1)
      self.grid_layout.addItem(self.amount_label, 3, 0)
      self.amount_layout = QGraphicsLinearLayout()
      self.amount_layout.addItem(self.amount)
      self.amount_layout.addItem(self.from_amount_label)
      self.amount_layout.addItem(self.equal_label)
      self.amount_layout.addItem(self.conversion_result)
      self.amount_layout.addItem(self.to_amount_label)
      self.grid_layout.addItem(self.amount_layout, 3, 1)
      self.grid_layout.addItem(self.credits_label, 4, 0, 1, 2)

      self.setLayout(self.grid_layout)
开发者ID:tanghus,项目名称:currency-converter-plasmoid,代码行数:26,代码来源:CurrencyConverter.py

示例3: init

    def init(self):

        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)

        self.settings = self.config()

        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)

        self.layout = QGraphicsGridLayout(self.applet)
        self.layout.setColumnSpacing(0,5.0)

        self.lblTitle = Plasma.Label(self.applet)
        self.lblTitle.nativeWidget().setText(
                                        ki18n("Stuff to get back").toString())
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setStyleSheet("""QLabel {
                                                text-align:center;
                                                font-style: italic;
                                                font-weight: bold;}""")
        self.layout.addItem(self.lblTitle,0,0,1,3)

        self.btnAdd = Plasma.PushButton(self.applet)
        self.btnAdd.nativeWidget().setGuiItem(KStandardGuiItem.Add)
        self.layout.addItem(self.btnAdd,1,0)

        self.btnRemove = Plasma.PushButton(self.applet)
        self.btnRemove.nativeWidget().setGuiItem(KStandardGuiItem.Remove)
        self.layout.addItem(self.btnRemove,1,2)

        self.db = GSBDbModel()

        self.view = Plasma.TreeView(self.applet)
        self.view.setModel(self.db)
        self.view.nativeWidget().setColumnHidden(self.db.IDCOL,True)
        self.view.nativeWidget().setRootIsDecorated(False)
        self.view.nativeWidget().setExpandsOnDoubleClick(False)
        self.view.nativeWidget().setItemsExpandable(False)
        self.view.setStyleSheet("""
            QTreeView {
                background-color: transparent;
                }
                QTreeView::item { padding-top:10px; padding-bottom: 10px; }
            """)
        self.view.nativeWidget().header().resizeSections(
                                                QHeaderView.ResizeToContents)
        self.view.nativeWidget().setItemDelegate(
                                            LoanDelegate(
                                                    self.applet,
                                                    self.view.nativeWidget()))


        self.layout.addItem(self.view,2,0,1,3)

        self.setLayout(self.layout)

        self.btnAdd.clicked.connect(self.add_loan)
        self.btnRemove.clicked.connect(self.remove_loan)
开发者ID:toyg,项目名称:plasmaapplets,代码行数:60,代码来源:main.py

示例4: makeLayout

	def makeLayout(self):
		self.layout = QGraphicsLinearLayout(Qt.Vertical)
		self.flowComboLayout = QGraphicsLinearLayout(Qt.Horizontal)
		self.flowLabelLayout = QGraphicsGridLayout()
		
		#Flow Layout
		self.flowData = SvJanez()
		self.flowView = QGraphicsWebView()
		self.flowView.setUrl( QUrl(self.flowData.flowImageUrl) )
		self.flowView.setEnabled(False)

		self.flowSelectorCombo = Plasma.ComboBox()
		self.flowSelectorCombo.addItem(u"Sveti Janez")
		self.flowSelectorCombo.addItem(u"Soteska")
		self.flowSelectorCombo.setMinimumWidth(125)
		self.flowSelectorCombo.textChanged.connect(self.flowSourceChanged)

		self.flowRefresh = Plasma.IconWidget()
		self.flowRefresh.setIcon("view-refresh")
		self.flowRefresh.clicked.connect(self.update)

		self.flowEnlargeButton = Plasma.IconWidget()
		self.flowEnlargeButton.setIcon("zoom-in")
		self.flowEnlargeButton.clicked.connect(self.showFullFlowWidget)

		self.flowLabel = Plasma.Label()
		self.flowLabel.setText(u"<b>Pretok:</b> ")
		self.flowDataLabel = Plasma.Label()
		self.flowLevelLabel = Plasma.Label()
		self.flowLevelLabel.setText(u"<b>Višina:</b> ")
		self.flowLevelDataLabel = Plasma.Label()
		self.flowTempLabel = Plasma.Label()
		self.flowTempLabel.setText(u"<b>Temperatura:</b> ")
		self.flowTempDataLabel = Plasma.Label()

		self.flowLabelLayout.addItem(self.flowLevelLabel,0,0)
		self.flowLabelLayout.addItem(self.flowLevelDataLabel,0,1)
		self.flowLabelLayout.addItem(self.flowLabel,1,0)
		self.flowLabelLayout.addItem(self.flowDataLabel,1,1)
		self.flowLabelLayout.addItem(self.flowTempLabel,2,0)
		self.flowLabelLayout.addItem(self.flowTempDataLabel,2,1)
		
		self.flowUpdateTimeSelector = UpdateTimeSelector()
		self.flowUpdateTimeSelector.setDefaultTime(4)
		self.flowUpdateTimeSelector.setDefaultInterval('h')
		self.flowUpdateTimeSelector.updateTimeSpin.valueChanged.connect(self.flowTimeChanged)
		self.flowUpdateTimeSelector.updateCheckBox.toggled.connect(self.flowTimerToggle)
		
		
		self.flowComboLayout.addItem(self.flowSelectorCombo)
		self.flowComboLayout.addStretch()
		self.flowComboLayout.addItem(self.flowEnlargeButton)
		self.flowComboLayout.addItem(self.flowRefresh)
		self.layout.addItem(self.flowComboLayout)
		self.layout.addItem(self.flowView)
		self.layout.addItem(self.flowLabelLayout)
		self.layout.addStretch()
		self.layout.addItem(self.flowUpdateTimeSelector.layout)
		self.layout.itemAt(0).setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed, QSizePolicy.DefaultType)
		self.layout.itemAt(2).setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed, QSizePolicy.DefaultType)
开发者ID:dbittman,项目名称:config-files,代码行数:60,代码来源:flowmodule.py

示例5: KTorrentView

class KTorrentView(plasmascript.Applet):
    def __init__(self,parent,args=None):
        plasmascript.Applet.__init__(self,parent)

    def init(self):
        self.setHasConfigurationInterface(False)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
        
        self.settings = self.config()

        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)

        self.layout = QGraphicsGridLayout(self.applet)
        self.layout.setColumnSpacing(0,5.0)
        
        self.setLayout(self.layout)
        self.resize(500,200)
开发者ID:toyg,项目名称:plasmaapplets,代码行数:19,代码来源:main.py

示例6: init

    def init(self):
	#self.moduller=self.link.Network.Firewall[dbus.String("iptables")].listModules()
	
	self.tahta=[[0,0,0],[0,0,0],[0,0,0]]
	
        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.Square)
        self.resize(450,250)
 
        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)
        self.layout=QGraphicsGridLayout(self.applet)
        
        #label = Plasma.Label(self.applet)
        #label.setText("<h1>Firewall Plasmoid</h1>")
        #self.kilit=Plasma.IconWidget(self.applet)
        #self.bilgi_label=Plasma.Label(self.applet)
        
        #self.baslat_pb=Plasma.PushButton(self.applet)
        #self.baslat_pb.setText("Start")
        #self.durdur_pb=Plasma.PushButton(self.applet)
        #self.durdur_pb.setText("Stop")
        
        self.tus1=Plasma.PushButton(self.applet)
	self.tus1.setText("")
	self.tus2=Plasma.PushButton(self.applet)
	self.tus2.setText("")
	self.tus3=Plasma.PushButton(self.applet)
	self.tus3.setText("")
	
	self.tus4=Plasma.PushButton(self.applet)
	self.tus4.setText("")
	self.tus5=Plasma.PushButton(self.applet)
	self.tus5.setText("")
	self.tus6=Plasma.PushButton(self.applet)
	self.tus6.setText("")
	
	self.tus7=Plasma.PushButton(self.applet)
	self.tus7.setText("")
	self.tus8=Plasma.PushButton(self.applet)
	self.tus8.setText("")
	self.tus9=Plasma.PushButton(self.applet)
	self.tus9.setText("")
        
        self.layout.addItem(self.tus1, 0, 0)
        self.layout.addItem(self.tus2, 0, 1)
        self.layout.addItem(self.tus3, 0, 2)
        self.layout.addItem(self.tus4, 1, 0)
        self.layout.addItem(self.tus5, 1, 1)
        self.layout.addItem(self.tus6, 1, 2)
        self.layout.addItem(self.tus7, 2, 0)
        self.layout.addItem(self.tus8, 2, 1)
        self.layout.addItem(self.tus9, 2, 2)
        self.applet.setLayout(self.layout)        
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:55,代码来源:main.py

示例7: __init__

    def __init__(self, parent=None, **kwargs):
        super().__init__(parent, **kwargs)
        self.__layoutMode = GraphicsThumbnailGrid.AutoReflow
        self.__columnCount = -1
        self.__thumbnails = []  # type: List[GraphicsThumbnailWidget]
        #: The current 'focused' thumbnail item. This is the item that last
        #: received the keyboard focus (though it does not necessarily have
        #: it now)
        self.__current = None  # type: Optional[GraphicsThumbnailWidget]
        self.__reflowPending = False

        self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        self.setContentsMargins(10, 10, 10, 10)
        # NOTE: Keeping a reference to the layout. self.layout()
        # returns a QGraphicsLayout wrapper (i.e. strips the
        # QGraphicsGridLayout-nes of the object).
        self.__layout = QGraphicsGridLayout()
        self.__layout.setContentsMargins(0, 0, 0, 0)
        self.__layout.setSpacing(10)
        self.setLayout(self.__layout)
开发者ID:BlazZupan,项目名称:orange3,代码行数:20,代码来源:owimageviewer.py

示例8: init

    def init(self):
	"""init method for the plasmoid. GUI stuff is located here."""
	
	self.moduller=self.link.Network.Firewall[dbus.String("iptables")].listModules()
	
        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.Square)
        self.resize(450,250)
 
        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)
        self.layout=QGraphicsGridLayout(self.applet)
        
        label = Plasma.Label(self.applet)
        label.setText("<h1>Firewall Plasmoid</h1>")
        self.kilit=Plasma.IconWidget(self.applet)
        self.bilgi_label=Plasma.Label(self.applet)
        
        self.baslat_pb=Plasma.PushButton(self.applet)
        self.baslat_pb.setText("Start")
        self.durdur_pb=Plasma.PushButton(self.applet)
        self.durdur_pb.setText("Stop")
	print "osman"
        if self.link.Network.Firewall[dbus.String("iptables")].getState()==dbus.String(u"on"):
	    self.bilgi_label.setText("<p style='color:green'>Firewall is working now.</p>")
	    self.kilit.setIcon("object-locked")
	    self.kilit.setMaximumSize(32,32)
	    self.kilit.setMinimumSize(32,32)
	    self.baslat_pb.setEnabled(False)
	    
	else:
	    self.bilgi_label.setText("<p style='color:red'>Firewall is stopped now.</p>")
	    self.kilit.setMaximumSize(32,32)
	    self.kilit.setMinimumSize(32,32)
	    self.kilit.setIcon("object-unlocked")
	    self.durdur_pb.setEnabled(False)
	
	self.bilgilendirme_baslik=Plasma.Label(self.applet)
	self.bilgilendirme_baslik.setText("Latest news:")
	
	self.bilgilendirme=Plasma.Label(self.applet)
	self.bilgilendirme.setText("Firewall Plasmoid has been started.")

        gelen_simge=Plasma.IconWidget(self.applet)
        gelen_simge.setIcon("application-x-smb-workgroup")
        paylasim_simge=Plasma.IconWidget(self.applet)
        paylasim_simge.setIcon("application-x-smb-server")
        giden_simge=Plasma.IconWidget(self.applet)
        giden_simge.setIcon("security-medium")
        
        self.kutular=[]
        sayi=0
        for i in self.moduller:
	    self.kutular.append(Plasma.CheckBox(self.applet))
	    self.kutular[sayi].setText(self.link.Network.Firewall[dbus.String("iptables")].moduleInfo(i)[0])
	    sayi+=1
	    
        
        self.layout.addItem(label, 0, 0,1,4)
        self.layout.addItem(self.kilit, 1,0)
        self.layout.addItem(self.bilgi_label,1,1)
        self.layout.addItem(self.baslat_pb,1,2)
        self.layout.addItem(self.durdur_pb,1,3)
        self.layout.addItem(gelen_simge,2,0,1,1)
        self.layout.addItem(paylasim_simge,3,0,1,1)
        self.layout.addItem(giden_simge,4,0,1,1)
        self.layout.addItem(self.bilgilendirme_baslik, 5,0,1,1)
        self.layout.addItem(self.bilgilendirme, 5,1,1,4)
        m=0
        for i in range(0,len(self.moduller)):
	    self.layout.addItem(self.kutular[m], m+2,1,1,4)
	    m+=1
        self.applet.setLayout(self.layout)        
        
        QObject.connect(self.baslat_pb, SIGNAL("clicked()"), self.baslat)
        QObject.connect(self.durdur_pb, SIGNAL("clicked()"), self.durdur)
        
        fonksiyonlar=[self.blockGelen, self.paylasim, self.blockGiden]
        for i in range(0, len(self.moduller)):
	    QObject.connect(self.kutular[i], SIGNAL("toggled(bool)"), fonksiyonlar[i])
	    
	self.bilgilendirme_iletileri=["Incoming connections was blocked successfully.",
	"Sharing internet is successful.",
	"Outgoing connections was blocked successfully."]
        
        self.link.listenSignals("Network.Firewall", self.handler)
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:87,代码来源:main.py

示例9: HelloWorldApplet

class HelloWorldApplet(plasmascript.Applet):
    def __init__(self,parent,args=None):
	"""Regular init method for the class of the plasmoid"""
        plasmascript.Applet.__init__(self,parent)
        self.link=comar.Link()
        
    def baslat(self):
	"""Method for openning the firewall manager"""
	try:#################try blogu eklendi burasi yapilacak.
	    self.link.Network.Firewall[dbus.String("iptables")].setState("on")
	    self.bilgi_label.setText("<p style='color:green'>Firewall is working now.</p>")
	    self.bilgilendirme.setText("Firewall has been started succesfully.")
	    self.baslat_pb.setEnabled(False)
	    self.durdur_pb.setEnabled(True)
	except dbus.exceptions.DBusException as hata:
	    self.bilgilendirme.setText(u"ERROR: Operation didn't perform.")
	    #print "HATA=",hata
	    

    def durdur(self):
	"""Method for closing the firewall manager"""
	try:
	    self.link.Network.Firewall[dbus.String("iptables")].setState("off")
	    self.bilgi_label.setText("<p style='color:red'>Firewall is stopped now.</p>")
	    self.bilgilendirme.setText("Firewall has been stopped succesfully.")
	    self.durdur_pb.setEnabled(False)
	    self.baslat_pb.setEnabled(True)
	except dbus.exceptions.DBusException as hata:
	    self.bilgilendirme.setText(u"ERROR: Operation didn't perform.")
	    
	
    def blockGelen(self, value):
        if self.kutular[0].isChecked():
	    self.link.Network.Firewall[dbus.String("iptables")].setModuleState("block_incoming","on")
	    self.bilgilendirme.setText(self.bilgilendirme_iletileri[0])
	else:
	    self.link.Network.Firewall[dbus.String("iptables")].setModuleState("block_incoming","off")
	    self.bilgilendirme.setText("Incoming connection blocking was stopped")
	    
    def paylasim(self, value):
        if self.kutular[1].isChecked():
	    self.link.Network.Firewall[dbus.String("iptables")].setModuleState("internet_sharing","on")
	    self.bilgilendirme.setText(self.bilgilendirme_iletileri[1])
	else:
	    self.link.Network.Firewall[dbus.String("iptables")].setModuleState("internet_sharing","off")
	    self.bilgilendirme.setText("Sharing internet was stopped")

    def blockGiden(self, value):
        if self.kutular[2].isChecked():
	    self.link.Network.Firewall[dbus.String("iptables")].setModuleState("block_outgoing","on")
	    self.bilgilendirme.setText(self.bilgilendirme_iletileri[2])
	else:
	    self.link.Network.Firewall[dbus.String("iptables")].setModuleState("block_outgoing","off")
	    self.bilgilendirme.setText("Outgoing connection blocking was stopped")
	
    def init(self):
	"""init method for the plasmoid. GUI stuff is located here."""
	
	self.moduller=self.link.Network.Firewall[dbus.String("iptables")].listModules()
	
        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.Square)
        self.resize(450,250)
 
        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)
        self.layout=QGraphicsGridLayout(self.applet)
        
        label = Plasma.Label(self.applet)
        label.setText("<h1>Firewall Plasmoid</h1>")
        self.kilit=Plasma.IconWidget(self.applet)
        self.bilgi_label=Plasma.Label(self.applet)
        
        self.baslat_pb=Plasma.PushButton(self.applet)
        self.baslat_pb.setText("Start")
        self.durdur_pb=Plasma.PushButton(self.applet)
        self.durdur_pb.setText("Stop")
	print "osman"
        if self.link.Network.Firewall[dbus.String("iptables")].getState()==dbus.String(u"on"):
	    self.bilgi_label.setText("<p style='color:green'>Firewall is working now.</p>")
	    self.kilit.setIcon("object-locked")
	    self.kilit.setMaximumSize(32,32)
	    self.kilit.setMinimumSize(32,32)
	    self.baslat_pb.setEnabled(False)
	    
	else:
	    self.bilgi_label.setText("<p style='color:red'>Firewall is stopped now.</p>")
	    self.kilit.setMaximumSize(32,32)
	    self.kilit.setMinimumSize(32,32)
	    self.kilit.setIcon("object-unlocked")
	    self.durdur_pb.setEnabled(False)
	
	self.bilgilendirme_baslik=Plasma.Label(self.applet)
	self.bilgilendirme_baslik.setText("Latest news:")
	
	self.bilgilendirme=Plasma.Label(self.applet)
	self.bilgilendirme.setText("Firewall Plasmoid has been started.")

        gelen_simge=Plasma.IconWidget(self.applet)
#.........这里部分代码省略.........
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:101,代码来源:main.py

示例10: WeatherApplet

class WeatherApplet(plasmascript.Applet):
    def __init__(self, parent, args=None):
        plasmascript.Applet.__init__(self, parent)
        self._unit = "SI"
        self._image_prefix = ":/images/"

        self._img_width = 16
        self._img_height = 16
        self._big_img_width = 48
        self._big_img_height = 48
        self._fc_column_width = 100

    def init(self):
        self.setHasConfigurationInterface(False)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)

        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)

        # self.layout = QGraphicsLinearLayout(Qt.Vertical, self.applet)
        self.layout_main = QGraphicsGridLayout(self.applet)
        self.layout_top_left = QGraphicsLinearLayout(Qt.Vertical, self.layout_main)
        self.layout_bottom = QGraphicsGridLayout(self.layout_main)
        self.layout_bottom.setColumnMaximumWidth(0, self._fc_column_width)
        self.layout_bottom.setColumnMaximumWidth(1, self._fc_column_width)
        self.layout_bottom.setColumnMaximumWidth(2, self._fc_column_width)

        self.lb_location = Plasma.Label(self.applet)
        self.lb_temperature = Plasma.Label(self.applet)
        self.lb_condition = Plasma.Label(self.applet)
        self.lb_humidity = Plasma.Label(self.applet)
        self.lb_wind = Plasma.Label(self.applet)

        # create svg widgets for conditions
        self.svg_w_current = Plasma.SvgWidget(self.applet)
        self.svg_w_fc1 = Plasma.SvgWidget(self.applet)
        self.svg_w_fc2 = Plasma.SvgWidget(self.applet)
        self.svg_w_fc3 = Plasma.SvgWidget(self.applet)

        # self.svg_w_fc1.resize(self._img_width,self._img_height)

        # create labels for forecast
        self.lb_temp_fc1 = Plasma.Label(self.applet)
        self.lb_temp_fc2 = Plasma.Label(self.applet)
        self.lb_temp_fc3 = Plasma.Label(self.applet)

        self.lb_day_fc1 = Plasma.Label(self.applet)
        self.lb_day_fc2 = Plasma.Label(self.applet)
        self.lb_day_fc3 = Plasma.Label(self.applet)

        # create images to display conditions
        self.svg_current = Plasma.Svg(self.applet)
        self.svg_fc1 = Plasma.Svg(self.applet)
        self.svg_fc2 = Plasma.Svg(self.applet)
        self.svg_fc3 = Plasma.Svg(self.applet)

        self.layout_main.addItem(self.layout_top_left, 0, 0)
        self.layout_main.addItem(self.svg_w_current, 0, 1)
        self.layout_main.addItem(self.layout_bottom, 1, 0, 1, 2, Qt.Alignment(Qt.AlignCenter))

        # add current conditions
        self.layout_top_left.addItem(self.lb_location)
        self.layout_top_left.addItem(self.lb_temperature)
        self.layout_top_left.addItem(self.lb_condition)
        self.layout_top_left.addItem(self.lb_humidity)
        self.layout_top_left.addItem(self.lb_wind)

        # add forecast labels for days
        self.layout_bottom.addItem(self.lb_day_fc1, 0, 0, 1, 1, Qt.Alignment(Qt.AlignHorizontal_Mask))
        self.layout_bottom.addItem(self.lb_day_fc2, 0, 1, 1, 1, Qt.Alignment(Qt.AlignHCenter))
        self.layout_bottom.addItem(self.lb_day_fc3, 0, 2, 1, 1, Qt.Alignment(Qt.AlignHCenter))
        # add forecast images
        self.layout_bottom.addItem(self.svg_w_fc1, 1, 0, 1, 1, Qt.Alignment(Qt.AlignLeft))
        self.layout_bottom.addItem(self.svg_w_fc2, 1, 1, 1, 1, Qt.Alignment(Qt.AlignLeft))
        self.layout_bottom.addItem(self.svg_w_fc3, 1, 2, 1, 1, Qt.Alignment(Qt.AlignLeft))
        # add forecast labels for temp
        self.layout_bottom.addItem(self.lb_temp_fc1, 2, 0, 1, 1, Qt.Alignment(Qt.AlignCenter))
        self.layout_bottom.addItem(self.lb_temp_fc2, 2, 1, 1, 1, Qt.Alignment(Qt.AlignCenter))
        self.layout_bottom.addItem(self.lb_temp_fc3, 2, 2, 1, 1, Qt.Alignment(Qt.AlignCenter))

        self.setLayout(self.layout_main)
        self.resize(375, 375)

        self.checkWeather()

        self.timer = QTimer()
        self.connect(self.timer, SIGNAL("timeout()"), self.checkWeather)
        self.timer.start(0.5 * 60000)

    def checkWeather(self):
        wi = WeatherInfo()
        mapper = ConditionMapper()
        wi.parse()
        weather = Weather()
        weather.extractData(wi, self._unit)

        self.lb_location.setText("Location: " + weather.location)

        self.lb_temperature.setText(weather.current_temperature)
#.........这里部分代码省略.........
开发者ID:rangalo,项目名称:plasma_pyweather,代码行数:101,代码来源:main.py

示例11: OWDistanceMap

class OWDistanceMap(widget.OWWidget):
    name = "Distance Map"
    description = "Visualize a distance matrix."
    icon = "icons/DistanceMatrix.svg"
    priority = 1200

    inputs = [("Distances", Orange.misc.DistMatrix, "set_distances")]
    outputs = [("Data", Orange.data.Table), ("Features", widget.AttributeList)]

    #: type of ordering to apply to matrix rows/columns
    NoOrdering, Clustering, OrderedClustering = 0, 1, 2

    sorting = settings.Setting(NoOrdering)

    colormap = settings.Setting(_default_colormap_index)
    color_gamma = settings.Setting(0.0)
    color_low = settings.Setting(0.0)
    color_high = settings.Setting(1.0)

    annotation_idx = settings.Setting(0)

    autocommit = settings.Setting(True)

    want_graph = True

    # Disable clustering for inputs bigger than this
    _MaxClustering = 3000

    # Disable cluster leaf ordering for inputs bigger than this
    _MaxOrderedClustering = 1000

    def __init__(self):
        super().__init__()

        self.matrix = None
        self._tree = None
        self._ordered_tree = None
        self._sorted_matrix = None
        self._sort_indices = None
        self._selection = None

        box = gui.widgetBox(self.controlArea, "Element sorting", margin=0)
        self.sorting_cb = gui.comboBox(
            box, self, "sorting",
            items=["None", "Clustering", "Clustering with ordered leaves"],
            callback=self._invalidate_ordering)

        box = gui.widgetBox(self.controlArea, "Colors")

        self.colormap_cb = gui.comboBox(
            box, self, "colormap", callback=self._update_color
        )
        self.colormap_cb.setIconSize(QSize(64, 16))
        self.palettes = list(_color_palettes)

        init_color_combo(self.colormap_cb, self.palettes, QSize(64, 16))
        self.colormap_cb.setCurrentIndex(self.colormap)

        form = QFormLayout(
            formAlignment=Qt.AlignLeft,
            labelAlignment=Qt.AlignLeft,
            fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow
        )
#         form.addRow(
#             "Gamma",
#             gui.hSlider(box, self, "color_gamma", minValue=0.0, maxValue=1.0,
#                         step=0.05, ticks=True, intOnly=False,
#                         createLabel=False, callback=self._update_color)
#         )
        form.addRow(
            "Low",
            gui.hSlider(box, self, "color_low", minValue=0.0, maxValue=1.0,
                        step=0.05, ticks=True, intOnly=False,
                        createLabel=False, callback=self._update_color)
        )
        form.addRow(
            "High",
            gui.hSlider(box, self, "color_high", minValue=0.0, maxValue=1.0,
                        step=0.05, ticks=True, intOnly=False,
                        createLabel=False, callback=self._update_color)
        )
        box.layout().addLayout(form)

        box = gui.widgetBox(self.controlArea, "Annotations")
        self.annot_combo = gui.comboBox(box, self, "annotation_idx",
                                        callback=self._invalidate_annotations,
                                        contentsLength=12)
        self.annot_combo.setModel(itemmodels.VariableListModel())
        self.annot_combo.model()[:] = ["None", "Enumeration"]
        self.controlArea.layout().addStretch()

        gui.auto_commit(self.controlArea, self, "autocommit",
                        "Send data", "Auto send is on")
        self.inline_graph_report()

        self.view = pg.GraphicsView(background="w")
        self.mainArea.layout().addWidget(self.view)

        self.grid_widget = pg.GraphicsWidget()
        self.grid = QGraphicsGridLayout()
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:orange3,代码行数:101,代码来源:owdistancemap.py

示例12: replot_experiments

    def replot_experiments(self):
        """Replot the whole quality plot.
        """
        self.scene.clear()
        labels = []

        max_dist = numpy.nanmax(list(filter(None, self.distances)))
        rug_widgets = []

        group_pen = QPen(Qt.black)
        group_pen.setWidth(2)
        group_pen.setCapStyle(Qt.RoundCap)
        background_pen = QPen(QColor(0, 0, 250, 150))
        background_pen.setWidth(1)
        background_pen.setCapStyle(Qt.RoundCap)

        main_widget = QGraphicsWidget()
        layout = QGraphicsGridLayout()
        attributes = self.data.domain.attributes
        if self.data is not None:
            for (group, indices), dist_vec in zip(self.groups, self.distances):
                indices_set = set(indices)
                rug_items = []
                if dist_vec is not None:
                    for i, attr in enumerate(attributes):
                        # Is this a within group distance or background
                        in_group = i in indices_set
                        if in_group:
                            rug_item = ClickableRugItem(dist_vec[i] / max_dist,
                                           1.0, self.on_rug_item_clicked)
                            rug_item.setPen(group_pen)
                            tooltip = experiment_description(attr)
                            rug_item.setToolTip(tooltip)
                            rug_item.group_index = indices.index(i)
                            rug_item.setZValue(rug_item.zValue() + 1)
                        else:
                            rug_item = ClickableRugItem(dist_vec[i] / max_dist,
                                           0.85, self.on_rug_item_clicked)
                            rug_item.setPen(background_pen)
                            tooltip = experiment_description(attr)
                            rug_item.setToolTip(tooltip)

                        rug_item.group = group
                        rug_item.index = i
                        rug_item.in_group = in_group

                        rug_items.append(rug_item)

                rug_widget = RugGraphicsWidget(parent=main_widget)
                rug_widget.set_rug(rug_items)

                rug_widgets.append(rug_widget)

                label = group_label(self.selected_split_by_labels(), group)
                label_item = QGraphicsSimpleTextItem(label, main_widget)
                label_item = GraphicsSimpleTextLayoutItem(label_item, parent=layout)
                label_item.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
                labels.append(label_item)

        for i, (label, rug_w) in enumerate(zip(labels, rug_widgets)):
            layout.addItem(label, i, 0, Qt.AlignVCenter)
            layout.addItem(rug_w, i, 1)
            layout.setRowMaximumHeight(i, 30)

        main_widget.setLayout(layout)
        self.scene.addItem(main_widget)
        self.main_widget = main_widget
        self.rug_widgets = rug_widgets
        self.labels = labels
        self.on_view_resize(self.scene_view.size())
开发者ID:astaric,项目名称:orange-bio,代码行数:70,代码来源:OWQualityControl.py

示例13: GSBApplet

class GSBApplet(plasmascript.Applet):
    def __init__(self,parent,args=None):
        plasmascript.Applet.__init__(self,parent)


    def init(self):

        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)

        self.settings = self.config()

        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)

        self.layout = QGraphicsGridLayout(self.applet)
        self.layout.setColumnSpacing(0,5.0)

        self.lblTitle = Plasma.Label(self.applet)
        self.lblTitle.nativeWidget().setText(
                                        ki18n("Stuff to get back").toString())
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setStyleSheet("""QLabel {
                                                text-align:center;
                                                font-style: italic;
                                                font-weight: bold;}""")
        self.layout.addItem(self.lblTitle,0,0,1,3)

        self.btnAdd = Plasma.PushButton(self.applet)
        self.btnAdd.nativeWidget().setGuiItem(KStandardGuiItem.Add)
        self.layout.addItem(self.btnAdd,1,0)

        self.btnRemove = Plasma.PushButton(self.applet)
        self.btnRemove.nativeWidget().setGuiItem(KStandardGuiItem.Remove)
        self.layout.addItem(self.btnRemove,1,2)

        self.db = GSBDbModel()

        self.view = Plasma.TreeView(self.applet)
        self.view.setModel(self.db)
        self.view.nativeWidget().setColumnHidden(self.db.IDCOL,True)
        self.view.nativeWidget().setRootIsDecorated(False)
        self.view.nativeWidget().setExpandsOnDoubleClick(False)
        self.view.nativeWidget().setItemsExpandable(False)
        self.view.setStyleSheet("""
            QTreeView {
                background-color: transparent;
                }
                QTreeView::item { padding-top:10px; padding-bottom: 10px; }
            """)
        self.view.nativeWidget().header().resizeSections(
                                                QHeaderView.ResizeToContents)
        self.view.nativeWidget().setItemDelegate(
                                            LoanDelegate(
                                                    self.applet,
                                                    self.view.nativeWidget()))


        self.layout.addItem(self.view,2,0,1,3)

        self.setLayout(self.layout)

        self.btnAdd.clicked.connect(self.add_loan)
        self.btnRemove.clicked.connect(self.remove_loan)

    def createConfigurationInterface(self, parent):
        self.configDlg = ConfigDlg(parent, self.applet)
        page = parent.addPage(self.configDlg,
                                ki18n("GetStuffBack Options").toString())
        page.setIcon(KIcon("user-desktop"))

        parent.okClicked.connect(self.configAccepted)

    def showConfigurationInterface(self):
        dialog = KPageDialog()
        dialog.setFaceType(KPageDialog.List)
        dialog.setButtons( KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel) )
        self.createConfigurationInterface(dialog)
        dialog.exec_()

    @pyqtSlot()
    def configAccepted(self):
        grace_period = self.configDlg.spinGrace.value()
        colour = self.configDlg.btnColour.color()

        options = self.settings.group("general")
        options.writeEntry("grace",grace_period)
        options.writeEntry("overdue_colour",colour.name())

    @pyqtSlot()
    def add_loan(self,*args):
        addDlg = AddDlg(self)
        result = addDlg.exec_()
        if result == False: return False
        ln = Loan()
        ln.item_description = unicode(addDlg.lineItemDescription.toPlainText())
        ln.person = unicode(addDlg.linePerson.text())
        ln.date = addDlg.dteDate.dateTime().toPyDateTime()
        ln.expected_date = addDlg.dteExpectedDate.dateTime().toPyDateTime()
#.........这里部分代码省略.........
开发者ID:toyg,项目名称:plasmaapplets,代码行数:101,代码来源:main.py

示例14: __init__

class FlowModule:
	def __init__(self):
		self.name = "Pretok"
		self.updateTimer = QTimer()
		self.updateTimer.timeout.connect(self.update)
	
	def makeLayout(self):
		self.layout = QGraphicsLinearLayout(Qt.Vertical)
		self.flowComboLayout = QGraphicsLinearLayout(Qt.Horizontal)
		self.flowLabelLayout = QGraphicsGridLayout()
		
		#Flow Layout
		self.flowData = SvJanez()
		self.flowView = QGraphicsWebView()
		self.flowView.setUrl( QUrl(self.flowData.flowImageUrl) )
		self.flowView.setEnabled(False)

		self.flowSelectorCombo = Plasma.ComboBox()
		self.flowSelectorCombo.addItem(u"Sveti Janez")
		self.flowSelectorCombo.addItem(u"Soteska")
		self.flowSelectorCombo.setMinimumWidth(125)
		self.flowSelectorCombo.textChanged.connect(self.flowSourceChanged)

		self.flowRefresh = Plasma.IconWidget()
		self.flowRefresh.setIcon("view-refresh")
		self.flowRefresh.clicked.connect(self.update)

		self.flowEnlargeButton = Plasma.IconWidget()
		self.flowEnlargeButton.setIcon("zoom-in")
		self.flowEnlargeButton.clicked.connect(self.showFullFlowWidget)

		self.flowLabel = Plasma.Label()
		self.flowLabel.setText(u"<b>Pretok:</b> ")
		self.flowDataLabel = Plasma.Label()
		self.flowLevelLabel = Plasma.Label()
		self.flowLevelLabel.setText(u"<b>Višina:</b> ")
		self.flowLevelDataLabel = Plasma.Label()
		self.flowTempLabel = Plasma.Label()
		self.flowTempLabel.setText(u"<b>Temperatura:</b> ")
		self.flowTempDataLabel = Plasma.Label()

		self.flowLabelLayout.addItem(self.flowLevelLabel,0,0)
		self.flowLabelLayout.addItem(self.flowLevelDataLabel,0,1)
		self.flowLabelLayout.addItem(self.flowLabel,1,0)
		self.flowLabelLayout.addItem(self.flowDataLabel,1,1)
		self.flowLabelLayout.addItem(self.flowTempLabel,2,0)
		self.flowLabelLayout.addItem(self.flowTempDataLabel,2,1)
		
		self.flowUpdateTimeSelector = UpdateTimeSelector()
		self.flowUpdateTimeSelector.setDefaultTime(4)
		self.flowUpdateTimeSelector.setDefaultInterval('h')
		self.flowUpdateTimeSelector.updateTimeSpin.valueChanged.connect(self.flowTimeChanged)
		self.flowUpdateTimeSelector.updateCheckBox.toggled.connect(self.flowTimerToggle)
		
		
		self.flowComboLayout.addItem(self.flowSelectorCombo)
		self.flowComboLayout.addStretch()
		self.flowComboLayout.addItem(self.flowEnlargeButton)
		self.flowComboLayout.addItem(self.flowRefresh)
		self.layout.addItem(self.flowComboLayout)
		self.layout.addItem(self.flowView)
		self.layout.addItem(self.flowLabelLayout)
		self.layout.addStretch()
		self.layout.addItem(self.flowUpdateTimeSelector.layout)
		self.layout.itemAt(0).setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed, QSizePolicy.DefaultType)
		self.layout.itemAt(2).setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed, QSizePolicy.DefaultType)
	
	def flowTimerToggle(self, toggled):
		if toggled:
			multiplier = 1
			if self.flowUpdateTimeSelector.getInterval() == 'min':
				multiplier = 60
			if self.flowUpdateTimeSelector.getInterval() == 'h':
				multiplier = 60 * 60
			self.updateTimer.start(self.flowUpdateTimeSelector.getTime() * 1000 * multiplier)
			self.update()
		else:
			self.updateTimer.stop()
	
	def flowTimeChanged(self, value):
		if self.flowUpdateTimeSelector.isChecked():
			self.updateTimer.stop()
		self.flowTimerToggle(self.flowUpdateTimeSelector.isChecked())
		
	def flowSourceChanged(self, text):
		if text == "Sveti Janez":
			self.flowData = SvJanez()
		else:
			self.flowData = Soteska()
		self.flowView.setUrl(QUrl(self.flowData.flowImageUrl))
		self.updateFlowLabels()
	
	def updateFlowImage(self):
		self.flowSourceChanged(self.flowSelectorCombo.text())
	
	def updateFlowLabels(self):
		self.flowData.fetchData()
		self.flowDataLabel.setText(u"%s %s" % (self.flowData.currentFlow, u' m3/s'))
		self.flowTempDataLabel.setText(u"%s %s" % (self.flowData.temperature , u' °C'))
		self.flowLevelDataLabel.setText(u"%s %s" % (self.flowData.waterLevel , u' cm'))
#.........这里部分代码省略.........
开发者ID:dbittman,项目名称:config-files,代码行数:101,代码来源:flowmodule.py

示例15: TaskCoachApplet

class TaskCoachApplet(plasmascript.Applet):
    def __init__(self,parent,args=None):
        plasmascript.Applet.__init__(self,parent)

    def init(self):
        self.setHasConfigurationInterface(False)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
        
        self.settings = self.config()

        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)

        self.layout = QGraphicsGridLayout(self.applet)
        self.layout.setColumnSpacing(0,5.0)
        
        # using the predefined KGuiItem objects save us a lot of work
        self.btnOpen = Plasma.PushButton(self.applet)
        self.btnOpen.nativeWidget().setGuiItem(KStandardGuiItem.Open)
        
        self.btnReset = Plasma.PushButton(self.applet)
        self.btnReset.nativeWidget().setGuiItem(KStandardGuiItem.Reset)
        
        self.btnSave = Plasma.PushButton(self.applet)
        self.btnSave.nativeWidget().setGuiItem(KStandardGuiItem.Save)

        self.btnSaveAs = Plasma.PushButton(self.applet)
        self.btnSaveAs.nativeWidget().setGuiItem(KStandardGuiItem.SaveAs)


        self.layout.addItem(self.btnOpen,0,0)
        self.layout.addItem(self.btnReset,0,1)
        self.layout.addItem(self.btnSave,2,1)
        self.layout.addItem(self.btnSaveAs,2,0)
        
        self.model = None
        self.filePath = None
  
        self.treeView = Plasma.TreeView(self.applet)
        self.treeView.setVisible(False)
        
        header = self.treeView.nativeWidget().header()
        header.setDefaultAlignment(Qt.AlignCenter)
        
        fontColor = self.theme.theme().color(Plasma.Theme.TextColor)
        
        header.setStyleSheet("""
            QHeaderView {
                color: %s; 
                font: bold italic;
            };
            """ % fontColor.name() )
        self.treeView.setStyleSheet("""
            QTreeView { background-color: transparent; color: %s;}; 
            """ % fontColor.name() )
        
                                                                                 
        self.treeView.setModel(self.model)
        self.layout.addItem(self.treeView,1,0,1,2)

        self.setLayout(self.layout)
        self.resize(350,500)
        
        self.btnOpen.clicked.connect(self.openFile)
        self.btnReset.clicked.connect(self.resetFile)
        self.btnSave.clicked.connect(self.saveFile)
        self.btnSaveAs.clicked.connect(self.saveFileAs)
        
        # FIXME: doesn't work
        QObject.connect(self.treeView.nativeWidget(),
            SIGNAL("dataChanged(QModelIndex,QModelIndex)"),
            self.onDataChanged)
        
        self.treeView.nativeWidget().setItemDelegate(
                                            ProgressDelegate(
                                                self.treeView.nativeWidget()))
        self.treeView.nativeWidget().header().setResizeMode(
                                                        QHeaderView.Interactive)
        self.treeView.nativeWidget().setEditTriggers(QTreeView.AllEditTriggers)	
        
    def _open(self,filePath):
        if not filePath.isEmpty():
            self.model = TaskListModel(str(filePath))
            self.treeView.setModel(self.model)
            self.treeView.nativeWidget().expandAll()
            self.treeView.nativeWidget().header().resizeSection(0,
                                    self.treeView.nativeWidget().width() * 0.8)
            self.treeView.nativeWidget().header().resizeSection(1,
                                    self.treeView.nativeWidget().width() * 0.1)
            self.filePath = filePath
            self.treeView.setVisible(True)
        
        
    @pyqtSlot()
    def openFile(self,*args):
        fPath = QFileDialog.getOpenFileName(None,
            "Select TaskCoach file",
            expanduser("~"),
            "TaskCoach files (*.tsk);;All Files(*.*)")
#.........这里部分代码省略.........
开发者ID:toyg,项目名称:plasmaapplets,代码行数:101,代码来源:main.py


注:本文中的PyQt4.QtGui.QGraphicsGridLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。