Commits

Alexey Elfman committed 25459b2

unresizeable window
#1 closed

Comments (0)

Files changed (3)

         super(MainForm, self).__init__()
         self.ui = Ui_MainWindow()
         self.ui.setupUi(self)
+
+        # window properties (make me tool)
+        #self.setWindowFlags(QtCore.Qt.Tool)
+        #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
+        #self.setWindowFlags(QtCore.Qt.Popup)
+        #self.setWindowFlags(QtCore.Qt.Dialog)
+        self.setFixedSize(self.width(), self.height())
+
         self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
 
         # centering on the desktop
         y = (desktop.height() - self.window().height()) / 3
         
         self.move(x, y)
-        
-        
+
+        self.commands = []
+        self.config_load()
+        self.paths = os.environ.get('PATH', '').split(':')
+
         self.connect(self.ui.runButton, QtCore.SIGNAL("clicked()"), self.run)
         self.connect(self.ui.command, QtCore.SIGNAL("editTextChanged(QString)"), self.command_changed)
         
-        self.commands = []
-        self.config_load()
 
     def config_init(self):
         path = os.path.join(os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config')), 'altf2')
 
     def command_changed(self, command):
         self.ui.statusbar.clearMessage()
+        try:
+            command = unicode(command).strip().split(' ')[0]
+        except:
+            command = None
+
+        if command:
+            if os.access(command, os.X_OK) and not os.path.isdir(command):
+                # ну набрал ты каталог, и чё?
+                return
+                
+            for path in self.paths:
+                fullname = os.path.join(path, command)
+                if os.path.exists(fullname) and os.access(fullname, os.X_OK) and not os.path.isdir(fullname):
+                    self.ui.statusbar.showMessage(fullname)
+                    break
+                
         
     def keyPressEvent(self, event):
         
 
 # Form implementation generated from reading ui file 'main.ui'
 #
-# Created: Fri Dec  7 12:32:41 2012
+# Created: Fri Dec  7 15:40:01 2012
 #      by: PyQt4 UI code generator 4.9.4
 #
 # WARNING! All changes made in this file will be lost!
         self.horizontalLayout_3.addLayout(self.horizontalLayout_2)
         MainWindow.setCentralWidget(self.centralwidget)
         self.statusbar = QtGui.QStatusBar(MainWindow)
+        self.statusbar.setSizeGripEnabled(False)
         self.statusbar.setObjectName(_fromUtf8("statusbar"))
         MainWindow.setStatusBar(self.statusbar)
 
     </item>
    </layout>
   </widget>
-  <widget class="QStatusBar" name="statusbar"/>
+  <widget class="QStatusBar" name="statusbar">
+   <property name="sizeGripEnabled">
+    <bool>false</bool>
+   </property>
+  </widget>
  </widget>
  <customwidgets>
   <customwidget>